/**
 * Shared data table + filter bar styles (warranty-registration reference).
 */

/* Muted filters card (filters_card_* partial) — keep outer border + radius intact */
.ui-filters-card {
  overflow: hidden;
}

.ui-filters-card > .card-header {
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
}

.ui-filters-card > .card-block,
.ui-filters-card > .card-body {
  overflow: visible;
}

/* Choices dropdown extends below the card — lift above the data table card */
.ui-filters-card:has(.choices.is-open),
.ui-filters-card:has(.ui-filter-date-range__preset-details[open]) {
  overflow: visible;
  position: relative;
  z-index: 100;
}

.ui-filters-card .ui-filter-bar [class*="col-"],
.ui-filters-card .ui-filter-bar .form-group,
.ui-filters-card .ui-filter-multiselect-slot {
  overflow: visible;
  min-width: 0;
}

/* Filter bar */
.ui-filter-bar {
  background-color: var(--color-base-50, #f8fafc);
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--color-base-200, #e2e8f0);
}

html.dark .ui-filter-bar,
html.theme-recon-dark .ui-filter-bar {
  background-color: rgba(15, 23, 42, 0.5);
  border-color: var(--recon-border, rgba(255, 255, 255, 0.08));
}

html.theme-recon-light .ui-filter-bar {
  background-color: var(--recon-surface-2, #f1f5f9);
  border-color: var(--recon-border, rgba(15, 23, 42, 0.1));
}

.ui-filter-bar .form-label,
.ui-filter-field__label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-base-500, #64748b);
  margin-bottom: 0.35rem;
  display: block;
}

.ui-filter-bar.ui-filter-bar--embedded,
.ui-filter-bar--embedded {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  margin-bottom: 0 !important;
  box-shadow: none !important;
}

html.dark .ui-filter-bar.ui-filter-bar--embedded,
html.theme-recon-dark .ui-filter-bar.ui-filter-bar--embedded,
html.theme-recon-light .ui-filter-bar.ui-filter-bar--embedded {
  background: transparent !important;
  border: none !important;
}

/* Data table card header (theme-safe; replaces bg-primary on data cards) */
.ui-data-card-header {
  background-color: var(--color-primary-600, #7c3aed) !important;
  border-bottom-color: var(--color-primary-700, #6d28d9) !important;
  color: #fff !important;
}

.ui-data-card-header h5,
.ui-data-card-header .ui-data-card-header__title {
  color: #fff !important;
}

html.light .ui-data-card-header,
html.theme-recon-light .ui-data-card-header {
  background: linear-gradient(135deg, var(--recon-accent) 0%, var(--recon-accent-deep) 100%) !important;
  border-bottom-color: transparent !important;
  color: #fff !important;
}

html.theme-recon-light .ui-data-card-header,
html.theme-recon-dark .ui-data-card-header {
  color: #fff !important;
}

html.light .ui-data-card-header h5,
html.light .ui-data-card-header h4,
html.theme-recon-light .ui-data-card-header h5,
html.theme-recon-light .ui-data-card-header h4,
html.theme-recon-dark .ui-data-card-header h5,
html.theme-recon-dark .ui-data-card-header h4 {
  color: #fff !important;
}

html.theme-recon-dark .ui-data-card-header {
  background: linear-gradient(135deg, var(--recon-accent-deep) 0%, #0c4a6e 100%) !important;
  border-bottom-color: var(--recon-border) !important;
}

html.theme-recon-light .ui-data-card-header .btn-light,
html.theme-recon-dark .ui-data-card-header .btn-light,
.ui-data-card-header .btn-light {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.22) !important;
}

html.theme-recon-light .ui-data-card-header .btn-light:hover,
html.theme-recon-dark .ui-data-card-header .btn-light:hover,
.ui-data-card-header .btn-light:hover {
  background: rgba(255, 255, 255, 0.22) !important;
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.35) !important;
}

.ui-data-card-header .btn-light:disabled,
.ui-data-card-header .btn-light.disabled {
  background: rgba(255, 255, 255, 0.08) !important;
  color: rgba(255, 255, 255, 0.45) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  opacity: 1;
}

/* Outline variants on colored headers — match btn-light (legacy pages) */
.ui-data-card-header .btn-outline-primary,
.ui-data-card-header .btn-outline-secondary,
.ui-data-card-header .btn-outline-success,
.ui-data-card-header .btn-outline-info,
.ui-data-card-header .btn-outline-dark,
.ui-data-card-header .btn-outline-light {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.28) !important;
}

.ui-data-card-header .btn-outline-primary:hover,
.ui-data-card-header .btn-outline-secondary:hover,
.ui-data-card-header .btn-outline-success:hover,
.ui-data-card-header .btn-outline-info:hover,
.ui-data-card-header .btn-outline-dark:hover {
  background: rgba(255, 255, 255, 0.22) !important;
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.4) !important;
}

.ui-data-card-header__actions .btn {
  font-weight: 500;
  white-space: nowrap;
}

.ui-data-card-header__actions .btn .me-1,
.ui-data-card-header__actions .btn i {
  opacity: 0.95;
}

/* Checkbox / actions align with inputs on the same row */
.ui-filter-field--align-end {
  display: flex;
  align-items: flex-end;
  padding-bottom: 0.125rem;
}

.ui-filter-field--align-end .form-check {
  margin-bottom: 0;
  white-space: nowrap;
}

.ui-filter-date-range__label-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.ui-filter-date-range__label-row .ui-filter-field__label {
  margin-bottom: 0;
}

.ui-filter-date-range__preset-details {
  position: relative;
  display: inline-block;
}

.ui-filter-date-range__preset-details > summary {
  list-style: none;
}

.ui-filter-date-range__preset-details > summary::-webkit-details-marker {
  display: none;
}

.ui-filter-date-range__preset-menu-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.2;
  color: var(--color-primary-600, #2563eb);
  text-decoration: underline;
  cursor: pointer;
  white-space: nowrap;
}

.ui-filter-date-range__preset-menu-btn:hover,
.ui-filter-date-range__preset-menu-btn:focus-visible {
  color: var(--color-primary-700, #1d4ed8);
}

.ui-filter-date-range__preset-menu-btn:focus-visible {
  outline: 2px solid var(--color-primary-400, #60a5fa);
  outline-offset: 2px;
}

html.dark .ui-filter-date-range__preset-menu-btn,
html.theme-recon-dark .ui-filter-date-range__preset-menu-btn {
  color: var(--color-primary-400, #60a5fa);
}

html.dark .ui-filter-date-range__preset-menu-btn:hover,
html.dark .ui-filter-date-range__preset-menu-btn:focus-visible,
html.theme-recon-dark .ui-filter-date-range__preset-menu-btn:hover,
html.theme-recon-dark .ui-filter-date-range__preset-menu-btn:focus-visible {
  color: var(--color-primary-300, #93c5fd);
}

.ui-filter-date-range__preset-menu-list {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  z-index: 1050;
  min-width: 10.5rem;
  margin: 0;
  padding: 0.25rem;
  list-style: none;
  border: 1px solid var(--color-base-200, #e2e8f0);
  border-radius: 0.375rem;
  background: var(--color-white, #fff);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}

.ui-filter-date-range__preset-details:not([open]) .ui-filter-date-range__preset-menu-list {
  display: none;
}

html.dark .ui-filter-date-range__preset-menu-list,
html.theme-recon-dark .ui-filter-date-range__preset-menu-list {
  border-color: var(--color-base-700, #334155);
  background: var(--color-base-900, #0f172a);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.ui-filter-date-range__preset-option {
  display: block;
  width: 100%;
  border: none;
  border-radius: 0.25rem;
  padding: 0.375rem 0.625rem;
  font-size: 0.8125rem;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  color: var(--color-base-800, #1e293b);
  background: transparent;
}

.ui-filter-date-range__preset-option:hover {
  background: var(--color-base-100, #f1f5f9);
}

html.dark .ui-filter-date-range__preset-option,
html.theme-recon-dark .ui-filter-date-range__preset-option {
  color: var(--color-base-100, #f1f5f9);
}

html.dark .ui-filter-date-range__preset-option:hover,
html.theme-recon-dark .ui-filter-date-range__preset-option:hover {
  background: var(--color-base-800, #1e293b);
}

.ui-filter-date-range__preset-divider {
  margin: 0.25rem 0;
  border-top: 1px solid var(--color-base-200, #e2e8f0);
}

html.dark .ui-filter-date-range__preset-divider,
html.theme-recon-dark .ui-filter-date-range__preset-divider {
  border-top-color: var(--color-base-700, #334155);
}

.ui-filter-date-range__preset-menu-list .ui-filter-date-preset-btn.active {
  background-color: var(--color-primary-50, #eff6ff);
  color: var(--color-primary-700, #1d4ed8);
  font-weight: 600;
}

html.dark .ui-filter-date-range__preset-menu-list .ui-filter-date-preset-btn.active,
html.theme-recon-dark .ui-filter-date-range__preset-menu-list .ui-filter-date-preset-btn.active {
  background-color: rgba(96, 165, 250, 0.15);
  color: var(--color-primary-300, #93c5fd);
}

.ui-filter-date-range__inputs {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  width: 100%;
}

.ui-filter-date-range__inputs .form-control {
  flex: 1 1 0;
  min-width: 8.5rem;
  width: auto;
}

.ui-filter-date-range__inputs .ui-filter-date-preset-select {
  flex: 0 1 11rem;
  min-width: 9.5rem;
  max-width: 12rem;
  padding-right: 2rem;
  font-size: 0.8125rem;
  color: var(--color-base-600, #475569);
}

/* Filters card: stack preset under dates inside the column (avoids overlapping sibling cols) */
.ui-filters-card .ui-filter-date-range-col--dropdown {
  max-width: 100%;
}

.ui-filters-card .ui-filter-date-range-col--dropdown .ui-filter-date-range__inputs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.5rem;
}

.ui-filters-card .ui-filter-date-range-col--dropdown .ui-filter-date-range__inputs .form-control,
.ui-filters-card .ui-filter-date-range-col--dropdown .ui-filter-date-range__inputs .ui-filter-date-preset-select {
  flex: none;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.ui-filters-card .ui-filter-date-range-col--dropdown .ui-filter-date-range__inputs .ui-filter-date-preset-select {
  grid-column: 1 / -1;
}

html.dark .ui-filter-date-range__inputs .ui-filter-date-preset-select,
html.theme-recon-dark .ui-filter-date-range__inputs .ui-filter-date-preset-select {
  color: var(--color-base-300, #cbd5e1);
}

.ui-filter-date-range-quick-row {
  padding-top: 0.25rem;
  border-top: 1px solid var(--color-base-200, #e2e8f0);
}

html.dark .ui-filter-date-range-quick-row,
html.theme-recon-dark .ui-filter-date-range-quick-row {
  border-top-color: var(--color-base-700, #334155);
}

html.theme-recon-dark .ui-filter-date-range-quick-row {
  border-top-color: var(--recon-border, rgba(255, 255, 255, 0.08));
}

.ui-filter-date-preset-btn.active:not(.dropdown-item) {
  background-color: var(--color-primary-600, #7c3aed) !important;
  border-color: var(--color-primary-700, #6d28d9) !important;
  color: #fff !important;
}

html.theme-recon-dark .ui-filter-date-preset-btn.active:not(.dropdown-item) {
  background-color: var(--recon-accent-deep) !important;
  border-color: var(--recon-accent) !important;
  color: #fff !important;
}

.ui-filter-bar__actions {
  margin-left: auto;
}

@media (max-width: 767.98px) {
  .ui-filter-date-range__inputs {
    flex-wrap: wrap;
  }
  .ui-filter-bar__actions {
    margin-left: 0;
    width: 100%;
  }
}

/* Table toolbar: bulk actions (left) · search / page size (right) */
.ui-table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.ui-table-toolbar__bulk {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  flex: 0 1 auto;
}

.ui-table-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.ui-table-toolbar__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.25;
  color: var(--color-base-700, #334155);
  background: var(--color-white, #fff);
  border: 1px solid var(--color-base-200, #e2e8f0);
  border-radius: 0.375rem;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

html.dark .ui-table-toolbar__btn,
html.theme-recon-dark .ui-table-toolbar__btn {
  color: var(--color-base-200, #e2e8f0);
  background: var(--color-base-800, #1e293b);
  border-color: var(--color-base-600, #475569);
}

.ui-table-toolbar__btn:hover:not(:disabled) {
  background: var(--color-base-100, #f1f5f9);
  border-color: var(--color-base-300, #cbd5e1);
}

.ui-table-toolbar__btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ui-table-toolbar__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-left: auto;
  flex: 1 1 12rem;
  min-width: 0;
}

.ui-table-toolbar__search {
  width: 100%;
  max-width: 20rem;
  min-width: 10rem;
  flex: 1 1 12rem;
}

.ui-table-toolbar:not(:has(.ui-table-toolbar__bulk)) .ui-table-toolbar__controls {
  margin-left: 0;
  width: 100%;
}

.ui-table-toolbar__page-size {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.ui-table-toolbar__page-size select {
  width: auto;
  min-width: 4.5rem;
}

/* Shared data table — horizontal rules only; no column grid (overrides .table-bordered) */
.ui-data-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
}

.ui-data-table th,
.ui-data-table td {
  border-left: none;
  border-right: none;
  border-top: none;
  border-bottom: 1px solid var(--color-base-200, #e2e8f0);
  padding: 0.625rem 0.75rem;
  vertical-align: middle;
}

.ui-data-table.table-bordered th,
.ui-data-table.table-bordered td {
  border-left: none;
  border-right: none;
  border-top: none;
  border-bottom: 1px solid var(--color-base-200, #e2e8f0);
}

.ui-data-table tbody tr:last-child td {
  border-bottom: none;
}

.ui-data-table-panel__frame .ui-data-table tbody tr:last-child td {
  border-bottom: none;
}

/* Column header row — single underline, no cell grid */
.ui-data-table thead th,
.ui-data-table thead.thead-dark th {
  background-color: var(--color-base-100, #f1f5f9);
  color: var(--color-base-600, #475569);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: none;
  border-bottom: 1px solid var(--color-base-300, #cbd5e1);
  white-space: nowrap;
}

html.dark .ui-data-table thead th,
html.theme-recon-dark .ui-data-table thead th,
html.dark .ui-data-table thead.thead-dark th,
html.theme-recon-dark .ui-data-table thead.thead-dark th {
  background-color: rgba(15, 23, 42, 0.65);
  color: var(--color-base-400, #94a3b8);
  border-bottom-color: var(--color-base-600, #475569);
}

html.theme-recon-light .ui-data-table thead th,
html.theme-recon-light .ui-data-table thead.thead-dark th {
  background-color: var(--recon-surface-2, #f1f5f9) !important;
  color: var(--recon-label, #64748b) !important;
  border: none !important;
  border-bottom: 1px solid var(--recon-border, rgba(15, 23, 42, 0.12)) !important;
}

html.theme-recon-dark .ui-data-table thead th,
html.theme-recon-dark .ui-data-table thead.thead-dark th {
  background: rgba(15, 23, 42, 0.65) !important;
  color: var(--recon-label, #94a3b8) !important;
  border: none !important;
  border-bottom: 1px solid var(--recon-border, rgba(255, 255, 255, 0.1)) !important;
}

.ui-data-table tbody td {
  color: var(--color-base-700, #334155);
  font-size: 0.8125rem;
}

html.dark .ui-data-table tbody td,
html.theme-recon-dark .ui-data-table tbody td {
  color: var(--recon-text, #e2e8f0);
  border-bottom-color: var(--color-base-700, #334155);
}

html.dark .ui-data-table.table-striped > tbody > tr:nth-of-type(odd) > td,
html.theme-recon-dark .ui-data-table.table-striped > tbody > tr:nth-of-type(odd) > td {
  background-color: rgba(255, 255, 255, 0.03);
}

html.dark .ui-data-table.table-striped > tbody > tr:nth-of-type(even) > td,
html.theme-recon-dark .ui-data-table.table-striped > tbody > tr:nth-of-type(even) > td {
  background-color: transparent;
}

html.dark .ui-data-table.table-striped > tbody > tr:hover > td,
html.theme-recon-dark .ui-data-table.table-striped > tbody > tr:hover > td {
  background-color: rgba(148, 163, 184, 0.1);
}

.ui-data-table .text-end {
  text-align: right;
}

.ui-data-table .tabular-nums {
  font-variant-numeric: tabular-nums;
}

.ui-data-table thead.sticky-top th {
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: none;
}

/* Sortable headers */
.ui-data-table th[data-sort],
table[data-ui-table] th[data-sort],
table[data-api-table] th[data-sort] {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.ui-data-table th[data-sort] .fa-sort,
table[data-ui-table] th[data-sort] .fa-sort,
table[data-api-table] th[data-sort] .fa-sort {
  opacity: 0.35;
  margin-left: 0.25rem;
  font-size: 0.75em;
}

.ui-data-table th[data-sort].sort-asc .fa-sort::before,
table[data-ui-table] th[data-sort].sort-asc .fa-sort::before,
table[data-api-table] th[data-sort].sort-asc .fa-sort::before {
  content: "\f0de";
  opacity: 1;
}

.ui-data-table th[data-sort].sort-desc .fa-sort::before,
table[data-ui-table] th[data-sort].sort-desc .fa-sort::before,
table[data-api-table] th[data-sort].sort-desc .fa-sort::before {
  content: "\f0dd";
  opacity: 1;
}

/* Scroll + sticky header */
.ui-data-table__scroll {
  max-height: 80vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* Panel frame: table + attached footer (single bordered unit) */
.ui-data-table-panel__frame {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-base-200, #e2e8f0);
  border-radius: 0.375rem;
  overflow: hidden;
  background: var(--color-white, #fff);
}

html.dark .ui-data-table-panel__frame,
html.theme-recon-dark .ui-data-table-panel__frame {
  border-color: var(--color-base-700, #334155);
  background: var(--recon-surface-1, #1e293b);
}

html.theme-recon-light .ui-data-table-panel__frame {
  border-color: var(--recon-border, rgba(15, 23, 42, 0.12));
  background: #fff;
}

.ui-data-table-panel__frame .ui-data-table__wrapper {
  flex: 0 1 auto;
  margin-bottom: 0;
}

.ui-data-table-panel__frame .ui-data-table__scroll {
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
  border: none;
}

.ui-data-table-panel__frame--scrollable .ui-data-table__wrapper {
  flex: 1 1 auto;
  min-height: 0;
}

.ui-data-table-panel__frame--scrollable .ui-data-table__scroll {
  max-height: var(--ui-data-table-max-height, min(70vh, 42rem));
  overflow: auto;
}

.ui-data-table-panel__frame .ui-data-table {
  margin-bottom: 0;
  border-left: none;
  border-right: none;
  border-top: none;
}

.ui-data-table-panel__frame .ui-data-table thead th {
  border-top: none;
}

/* Cell ellipsis (opt-in via class on table) */
.ui-data-table--ellipsis th,
.ui-data-table--ellipsis td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Tabs above table */
.ui-table-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0;
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem;
  border-bottom: 1px solid var(--color-base-200, #e2e8f0);
}

html.dark .ui-table-tabs,
html.theme-recon-dark .ui-table-tabs {
  border-color: var(--color-base-700, #334155);
}

.ui-table-tabs__item {
  display: block;
  margin: 0;
  padding: 0;
}

.ui-table-tabs__link,
.ui-table-tabs .nav-link {
  display: inline-block;
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 0.625rem 1rem;
  color: var(--color-base-600, #475569);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.25;
  font-size: 0.875rem;
}

html.dark .ui-table-tabs__link,
html.theme-recon-dark .ui-table-tabs__link,
html.dark .ui-table-tabs .nav-link,
html.theme-recon-dark .ui-table-tabs .nav-link {
  color: var(--color-base-400, #94a3b8);
}

.ui-table-tabs__link:hover,
.ui-table-tabs .nav-link:hover {
  color: var(--color-base-900, #0f172a);
  text-decoration: none;
}

html.dark .ui-table-tabs__link:hover,
html.theme-recon-dark .ui-table-tabs__link:hover {
  color: var(--color-base-100, #f1f5f9);
}

.ui-table-tabs__link.active,
.ui-table-tabs .nav-link.active {
  color: var(--color-primary-600, #7c3aed);
  border-bottom-color: var(--color-primary-600, #7c3aed);
  font-weight: 600;
}

html.theme-recon-light .ui-table-tabs__link.active {
  color: var(--recon-accent, #0d9488);
  border-bottom-color: var(--recon-accent, #0d9488);
}

/* Pagination (no Bootstrap — ui-pagination only) */
.ui-pagination {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.ui-pagination__item {
  display: flex;
  flex-shrink: 0;
  list-style: none;
}

.ui-pagination__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1;
  color: var(--color-base-700, #334155);
  background: var(--color-white, #fff);
  border: 1px solid var(--color-base-200, #e2e8f0);
  border-radius: 0.375rem;
  cursor: pointer;
  font-family: inherit;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

html.dark .ui-pagination__btn,
html.theme-recon-dark .ui-pagination__btn {
  color: var(--color-base-200, #e2e8f0);
  background: var(--color-base-800, #1e293b);
  border-color: var(--color-base-600, #475569);
}

.ui-pagination__btn:hover:not(:disabled) {
  background: var(--color-base-100, #f1f5f9);
  border-color: var(--color-base-300, #cbd5e1);
}

html.dark .ui-pagination__btn:hover:not(:disabled),
html.theme-recon-dark .ui-pagination__btn:hover:not(:disabled) {
  background: var(--color-base-700, #334155);
}

.ui-pagination__item--active .ui-pagination__btn {
  color: #fff;
  background: var(--color-primary-600, #7c3aed);
  border-color: var(--color-primary-600, #7c3aed);
  cursor: default;
}

html.theme-recon-light .ui-pagination__item--active .ui-pagination__btn {
  background: var(--recon-accent, #0d9488);
  border-color: var(--recon-accent, #0d9488);
}

.ui-pagination__item--disabled .ui-pagination__btn {
  opacity: 0.45;
  cursor: not-allowed;
}

.ui-pagination__ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 2rem;
  font-size: 0.875rem;
  color: var(--color-base-400, #94a3b8);
}

/* Table footer (pagination); use --attached inside ui-data-table-panel__frame */
.ui-data-table-footer {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--color-base-200, #e2e8f0);
}

.ui-data-table-footer--attached {
  flex-shrink: 0;
  margin-top: 0;
  padding: 0.625rem 1rem;
  border-top: 1px solid var(--color-base-200, #e2e8f0);
  background: var(--color-base-50, #f8fafc);
}

html.dark .ui-data-table-footer,
html.theme-recon-dark .ui-data-table-footer {
  border-top-color: var(--color-base-700, #334155);
}

html.dark .ui-data-table-footer--attached,
html.theme-recon-dark .ui-data-table-footer--attached {
  background: rgba(15, 23, 42, 0.55);
  border-top-color: var(--color-base-700, #334155);
}

html.theme-recon-light .ui-data-table-footer--attached {
  background: var(--recon-surface-2, #f1f5f9);
  border-top-color: var(--recon-border, rgba(15, 23, 42, 0.1));
}

.ui-data-table-summary {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  background: var(--color-base-50, #f8fafc);
  border: 1px solid var(--color-base-200, #e2e8f0);
}

html.dark .ui-data-table-summary,
html.theme-recon-dark .ui-data-table-summary {
  background: rgba(15, 23, 42, 0.45);
  border-color: var(--recon-border, rgba(255, 255, 255, 0.08));
}

html.theme-recon-light .ui-data-table-summary {
  background: var(--recon-surface-2, #f1f5f9);
  border-color: var(--recon-border, rgba(15, 23, 42, 0.1));
}

.ui-data-table-summary__title {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-base-500, #64748b);
}

.ui-data-table-summary__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
  gap: 0.75rem 1rem;
}

.ui-data-table-summary__item {
  text-align: center;
  min-width: 0;
}

.ui-data-table-summary__value {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-base-900, #0f172a);
  font-variant-numeric: tabular-nums;
}

html.dark .ui-data-table-summary__value,
html.theme-recon-dark .ui-data-table-summary__value {
  color: var(--recon-text, #f1f5f9);
}

.ui-data-table-summary__label {
  margin-top: 0.25rem;
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-base-500, #64748b);
}

.ui-data-table-summary__item--warning .ui-data-table-summary__value {
  color: var(--color-warning-600, #d97706);
}

.ui-data-table-summary__item--success .ui-data-table-summary__value {
  color: var(--color-success-600, #16a34a);
}

.ui-data-table-summary__item--danger .ui-data-table-summary__value {
  color: var(--color-danger-600, #dc2626);
}

.ui-data-table-summary--above-table {
  margin-bottom: 0.75rem;
}

.ui-data-table-footer__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.ui-data-table-footer__info {
  font-size: 0.875rem;
  color: var(--color-base-600, #475569);
  flex: 1 1 auto;
  min-width: 10rem;
}

html.dark .ui-data-table-footer__info,
html.theme-recon-dark .ui-data-table-footer__info {
  color: var(--color-base-400, #94a3b8);
}

.ui-data-table-footer__info:empty {
  display: none;
}

.ui-data-table-footer__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  flex: 0 1 auto;
  margin-left: auto;
}

.ui-data-table-footer .ui-table-toolbar__page-size {
  flex-shrink: 0;
}

/* Row states (Sold Products: refund, missing status) — apply to cells so hover/stripe cannot wash them out */
tr.row-status-refunded > td {
  background-color: #e0f2fe;
  color: var(--color-base-800, #1e293b);
}

tr.row-status-null > td {
  background-color: #ffe4e6;
  color: var(--color-base-800, #1e293b);
}

html.dark tr.row-status-refunded > td,
html.theme-recon-dark tr.row-status-refunded > td,
body.dark tr.row-status-refunded > td {
  background-color: rgba(59, 130, 246, 0.16) !important;
  color: var(--recon-text, #e2e8f0) !important;
  box-shadow: inset 3px 0 0 rgba(96, 165, 250, 0.65);
}

html.dark tr.row-status-null > td,
html.theme-recon-dark tr.row-status-null > td,
body.dark tr.row-status-null > td {
  background-color: rgba(251, 191, 36, 0.1) !important;
  color: var(--recon-text, #e2e8f0) !important;
  box-shadow: inset 3px 0 0 rgba(251, 191, 36, 0.5);
}

html.dark .table-hover tr.row-status-refunded:hover > td,
html.theme-recon-dark .table-hover tr.row-status-refunded:hover > td,
html.dark .table-hover tr.row-status-null:hover > td,
html.theme-recon-dark .table-hover tr.row-status-null:hover > td {
  background-color: rgba(148, 163, 184, 0.14) !important;
}

html.dark .table-hover tr.row-status-refunded:hover > td,
html.theme-recon-dark .table-hover tr.row-status-refunded:hover > td {
  background-color: rgba(59, 130, 246, 0.22) !important;
}

html.dark .table-hover tr.row-status-null:hover > td,
html.theme-recon-dark .table-hover tr.row-status-null:hover > td {
  background-color: rgba(251, 191, 36, 0.16) !important;
}

.ui-data-table tr.row-status-refunded > td:nth-child(4),
.ui-data-table tr.row-status-null > td:nth-child(4) {
  font-weight: 600;
}

html.dark .ui-data-table tr.row-status-refunded > td:nth-child(4),
html.theme-recon-dark .ui-data-table tr.row-status-refunded > td:nth-child(4) {
  color: #93c5fd !important;
}

html.dark .ui-data-table tr.row-status-null > td:nth-child(4),
html.theme-recon-dark .ui-data-table tr.row-status-null > td:nth-child(4) {
  color: #fcd34d !important;
}

/* Refresh spin */
.ui-table-page .fa-refresh.fa-spin {
  animation: ui-spin 1s infinite linear;
}

/* Table page card body — uniform inset on all sides (matches .card-block) */
.ui-table-page__body.card-block {
  padding: var(--ui-table-page-inset, 1.25rem);
}

.ui-table-page__body [data-ui-table-wrapper] {
  display: flex;
  flex-direction: column;
  gap: var(--ui-table-page-gap, 0.75rem);
}

@keyframes ui-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Collapsible <details> stack (e.g. end-of-day payment locations) */
.ui-details-stack {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ui-details-item {
  border: 1px solid var(--color-base-200, #e2e8f0);
  border-radius: 0.5rem;
  background: var(--color-base-50, #f8fafc);
  overflow: hidden;
}

html.dark .ui-details-item,
html.theme-recon-dark .ui-details-item {
  border-color: var(--recon-border, rgba(255, 255, 255, 0.08));
  background: rgba(15, 23, 42, 0.45);
}

html.theme-recon-light .ui-details-item {
  border-color: var(--recon-border, rgba(15, 23, 42, 0.1));
  background: var(--recon-surface-2, #f1f5f9);
}

.ui-details-item__summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  list-style: none;
  font-weight: 500;
  color: var(--color-base-800, #1e293b);
}

.ui-details-item__summary::-webkit-details-marker {
  display: none;
}

.ui-details-item__summary::after {
  content: "\f078";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--color-base-500, #64748b);
  transition: transform 0.15s ease;
}

.ui-details-item[open] > .ui-details-item__summary::after {
  transform: rotate(180deg);
}

html.dark .ui-details-item__summary,
html.theme-recon-dark .ui-details-item__summary {
  color: var(--recon-text, #f8fafc);
}

html.theme-recon-light .ui-details-item__summary {
  color: var(--recon-text, #0f172a);
}

html.dark .ui-details-item__summary::after,
html.theme-recon-dark .ui-details-item__summary::after {
  color: var(--recon-label, #64748b);
}

.ui-details-item__name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-base-900, #0f172a);
}

html.dark .ui-details-item__name,
html.theme-recon-dark .ui-details-item__name {
  color: var(--recon-text, #f8fafc);
}

html.theme-recon-light .ui-details-item__name {
  color: var(--recon-text, #0f172a);
}

.ui-details-item__meta {
  flex: 1 1 100%;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--color-base-600, #475569);
  line-height: 1.5;
}

@media (min-width: 576px) {
  .ui-details-item__meta {
    flex: 1 1 auto;
  }
}

html.dark .ui-details-item__meta,
html.theme-recon-dark .ui-details-item__meta {
  color: var(--recon-text-muted, #94a3b8);
}

html.theme-recon-light .ui-details-item__meta {
  color: var(--recon-text-muted, #475569);
}

.ui-details-item__body {
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid var(--color-base-200, #e2e8f0);
}

html.dark .ui-details-item__body,
html.theme-recon-dark .ui-details-item__body {
  border-top-color: var(--recon-border, rgba(255, 255, 255, 0.08));
}

html.theme-recon-light .ui-details-item__body {
  border-top-color: var(--recon-border, rgba(15, 23, 42, 0.1));
}

.ui-details-item__actions {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.ui-details-item__empty {
  color: var(--color-base-500, #64748b);
  font-size: 0.875rem;
}

html.dark .ui-details-item__empty,
html.theme-recon-dark .ui-details-item__empty {
  color: var(--recon-label, #64748b);
}

html.theme-recon-light .ui-details-item__empty {
  color: var(--recon-text-muted, #475569);
}

html.theme-recon-dark .ui-details-item .ui-data-table tbody td,
html.theme-recon-dark .ui-details-item .ui-data-table tbody th {
  color: var(--recon-text-muted, #94a3b8);
  border-bottom-color: var(--recon-border, rgba(255, 255, 255, 0.08));
}

html.theme-recon-light .ui-details-item .ui-data-table tbody td {
  color: var(--recon-text-muted, #475569);
}

.ui-details-item .ui-data-table-panel__frame {
  margin-bottom: 0;
}

/* Chart semantic colours (light / dark — used by floorplan match-status pie, etc.) */
:root,
html.theme-recon-light {
  --ui-chart-match-success: #0d9488;
  --ui-chart-match-warning: #d97706;
  --ui-chart-match-danger: #e11d48;
  --ui-chart-match-info: #4f46e5;
  --ui-chart-match-neutral: #64748b;
}

html.dark,
html.theme-recon-dark {
  --ui-chart-match-success: #2dd4bf;
  --ui-chart-match-warning: #fbbf24;
  --ui-chart-match-danger: #fb7185;
  --ui-chart-match-info: #a5b4fc;
  --ui-chart-match-neutral: #94a3b8;
}

:root,
html.theme-recon-light {
  --ui-chart-pie-border: #ffffff;
}

html.dark,
html.theme-recon-dark {
  --ui-chart-pie-border: #1e293b;
}

/* Chart cards (shared — floorplan, revenue reconciliation, etc.) */
.ui-chart-card__subtitle {
  color: rgba(255, 255, 255, 0.85) !important;
  opacity: 1;
  font-weight: 400;
}

.ui-data-card-header .ui-chart-card__subtitle {
  color: rgba(255, 255, 255, 0.85) !important;
}

.ui-chart-card__body {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

/* Chart cards in dashboard rows — rounded top corners on header + shell */
.ui-charts-row .card.ui-chart-card {
  border-radius: var(--recon-radius, 0.75rem);
  overflow: hidden;
  border: 1px solid var(--recon-border, var(--color-base-200, #e2e8f0));
}

.ui-charts-row .card.ui-chart-card > .ui-data-card-header {
  border-radius: var(--recon-radius, 0.75rem) var(--recon-radius, 0.75rem) 0 0;
}

html.theme-recon-dark .ui-charts-row .card.ui-chart-card,
html.theme-recon-light .ui-charts-row .card.ui-chart-card {
  border-radius: var(--recon-radius, 12px);
}

html.theme-recon-dark .ui-charts-row .card.ui-chart-card > .ui-data-card-header,
html.theme-recon-light .ui-charts-row .card.ui-chart-card > .ui-data-card-header {
  border-radius: var(--recon-radius, 12px) var(--recon-radius, 12px) 0 0;
}

.ui-table-page__body .ui-charts-row {
  overflow: visible;
}

.ui-chart-card--pie .ui-chart-card__body {
  overflow: visible;
  padding-bottom: 1rem;
}

.ui-chart-card--pie .ui-chart-legend,
.ui-chart-pie-layout .ui-chart-legend {
  flex-shrink: 0;
  min-height: 2.25rem;
  position: relative;
  z-index: 2;
}

.ui-chart-card .chart-container,
.ui-chart-card .ui-chart-embed {
  position: relative;
  width: 100%;
  min-height: 0;
  overflow: hidden;
}

.ui-chart-card .chart-container canvas.chart,
.ui-chart-card .ui-chart-embed:not(.ui-chart-pie-layout) canvas.chart {
  display: block;
  width: 100% !important;
  max-width: 100%;
}

.ui-charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (min-width: 1200px) {
  .ui-charts-row--compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.ui-charts-row--compact .ui-chart-card .chart-container,
.ui-charts-row--compact .ui-chart-card .ui-chart-embed:not(.ui-chart-embed--pie) {
  height: 220px;
  max-height: 220px;
}

/* Pie chart: fixed square canvas + external HTML legend (labels outside Chart.js) */
.ui-chart-pie-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 0.75rem;
  padding: 0.25rem 0 0.5rem;
}

.ui-chart-pie-layout__canvas {
  position: relative;
  width: 180px;
  height: 180px;
  flex: 0 0 180px;
}

.ui-chart-pie-layout__canvas > div {
  width: 180px !important;
  height: 180px !important;
  max-width: 180px;
  max-height: 180px;
}

.ui-chart-pie-layout__canvas canvas.chart {
  display: block;
  width: 180px !important;
  height: 180px !important;
  max-width: 180px !important;
  max-height: 180px !important;
}

.ui-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 0.75rem 0.5rem 0.25rem;
  margin-top: 0.25rem;
  border-top: 1px solid var(--recon-border, var(--color-base-200, #e2e8f0));
  font-family: var(--recon-font, inherit);
  visibility: visible;
}

.ui-chart-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.25;
  color: #475569;
}

html.dark .ui-chart-legend__item,
html.theme-recon-dark .ui-chart-legend__item {
  color: #cbd5e1;
}

html.light .ui-chart-legend__item,
html.theme-recon-light .ui-chart-legend__item {
  color: #475569;
}

.ui-chart-pie-layout .ui-chart-legend__label {
  color: inherit;
}

.ui-chart-legend__swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.ui-chart-legend__swatch--success {
  background: var(--ui-chart-match-success);
}

.ui-chart-legend__swatch--warning {
  background: var(--ui-chart-match-warning);
}

.ui-chart-legend__swatch--danger {
  background: var(--ui-chart-match-danger);
}

.ui-chart-legend__swatch--info {
  background: var(--ui-chart-match-info);
}

.ui-chart-legend__swatch--neutral {
  background: var(--ui-chart-match-neutral);
}

.ui-chart-legend__value {
  opacity: 0.85;
}

/* Revenue reconciliation charts (production-style, themed cards) */
.ui-recon-chart-card {
  --recon-xero: #13B5EA;
  --recon-rs: #FF6B35;
  --recon-diff: #8B5CF6;
  --recon-unpaid: #F59E0B;
}

.ui-recon-chart-container,
.ui-chart-canvas-container {
  position: relative;
  height: 350px;
  width: 100%;
}

.ui-chart-canvas-container--tall {
  height: 400px;
}

.ui-chart-canvas-container--tall .chart-container {
  height: 100%;
  min-height: 400px;
}

.ui-recon-chart-container canvas,
.ui-chart-canvas-container canvas {
  display: block;
  width: 100% !important;
  max-width: 100%;
}

.ui-recon-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--recon-border, var(--color-base-200, #e2e8f0));
  font-family: var(--recon-font, inherit);
}

.ui-recon-chart-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--recon-label, var(--color-base-500, #64748b));
}

html.dark .ui-recon-chart-legend__item,
html.theme-recon-dark .ui-recon-chart-legend__item {
  color: var(--recon-text-muted, var(--color-base-400, #94a3b8));
}

html.theme-recon-light .ui-recon-chart-legend__item {
  color: var(--recon-label, #64748b);
}

.ui-recon-chart-legend__swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.ui-recon-chart-legend__swatch--xero {
  background: var(--recon-xero);
}

.ui-recon-chart-legend__swatch--rs {
  background: var(--recon-rs);
}

.ui-recon-chart-legend__swatch--diff {
  background: rgba(139, 92, 246, 0.7);
}

.ui-recon-chart-legend__swatch--unpaid {
  background: var(--recon-unpaid);
  opacity: 0.6;
}

@media (max-width: 768px) {
  .ui-recon-chart-container,
  .ui-chart-canvas-container {
    height: 280px;
  }
}

/* Logistics table footer totals */
.ui-data-table__foot th,
.ui-data-table__foot td {
  font-weight: 600;
  border-top: 2px solid var(--recon-border, var(--color-base-200, #e2e8f0));
  background: var(--color-base-50, #f8fafc);
  color: var(--recon-text, var(--color-base-700, #334155));
}

html.dark .ui-data-table__foot th,
html.dark .ui-data-table__foot td,
html.theme-recon-dark .ui-data-table__foot th,
html.theme-recon-dark .ui-data-table__foot td {
  background: rgba(15, 23, 42, 0.5);
  color: var(--recon-text-muted, var(--color-base-300, #cbd5e1));
  border-top-color: var(--recon-border, rgba(255, 255, 255, 0.08));
}

html.theme-recon-light .ui-data-table__foot th,
html.theme-recon-light .ui-data-table__foot td {
  background: var(--recon-surface-2, #f1f5f9);
  color: var(--recon-label, #64748b);
}

/* Toast notifications (showToast in ui-utils.js) */
.ui-toast-container,
#alert-container.ui-toast-container,
#alert-container:empty {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(24rem, calc(100vw - 2rem));
  pointer-events: none;
}

#alert-container:not(:empty) {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(24rem, calc(100vw - 2rem));
  pointer-events: none;
}

.ui-toast {
  pointer-events: auto;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.4;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 1px solid transparent;
  animation: ui-toast-in 0.2s ease-out;
}

.ui-toast--success {
  background: #d1e7dd;
  border-color: #a3cfbb;
  color: #0f5132;
}

.ui-toast--error {
  background: #f8d7da;
  border-color: #f1aeb5;
  color: #842029;
}

.ui-toast--warning {
  background: #fff3cd;
  border-color: #ffe69c;
  color: #664d03;
}

.ui-toast--info {
  background: #cff4fc;
  border-color: #9eeaf9;
  color: #055160;
}

.ui-toast--leaving {
  opacity: 0;
  transform: translateX(0.5rem);
  transition: opacity 0.3s, transform 0.3s;
}

html.dark .ui-toast--success {
  background: #14532d;
  border-color: #166534;
  color: #bbf7d0;
}

html.dark .ui-toast--error {
  background: #7f1d1d;
  border-color: #991b1b;
  color: #fecaca;
}

html.dark .ui-toast--warning {
  background: #713f12;
  border-color: #a16207;
  color: #fef08a;
}

@keyframes ui-toast-in {
  from {
    opacity: 0;
    transform: translateX(0.5rem);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
