/* Keep kit tab More control on the same row as visible tabs (max 5 + More). */
.cicosy-invoice-tabs-shell,
.cicosy-ledger-tabs-shell,
.accounting-compliance-tabs-shell {
  overflow-x: visible !important;
  overflow-y: visible !important;
}

.cicosy-invoice-tabs,
.cicosy-ledger-tabs {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  height: 100% !important;
  overflow: visible !important;
}

.cicosy-tab-is-overflowed {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  pointer-events: none !important;
}

.cicosy-tab-overflow {
  position: relative !important;
  display: inline-flex !important;
  align-items: stretch !important;
  align-self: stretch !important;
  flex: 0 0 auto !important;
  height: 100% !important;
  min-width: 0 !important;
  z-index: 20;
}

.cicosy-tab-overflow-toggle {
  display: inline-flex !important;
  align-items: center !important;
  align-self: stretch !important;
  height: 100% !important;
  white-space: nowrap !important;
  gap: 0.35rem;
}

.cicosy-tab-overflow-menu {
  display: none;
  position: absolute;
  top: calc(100% + 0.25rem);
  right: 0;
  left: auto;
  min-width: 14rem;
  max-width: min(22rem, 90vw);
  max-height: min(20rem, 55vh);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.35rem;
  margin: 0;
  list-style: none;
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #dee2e6);
  border-radius: 0.5rem;
  box-shadow: 0 0.5rem 1.25rem rgba(33, 37, 41, 0.16);
  z-index: 40;
}

.cicosy-tab-overflow.is-open .cicosy-tab-overflow-menu {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.cicosy-tab-overflow-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 0.35rem;
  background: transparent;
  color: var(--color-text, #212529);
  padding: 0.55rem 0.75rem;
  font: inherit;
  cursor: pointer;
}

.cicosy-tab-overflow-item:hover,
.cicosy-tab-overflow-item:focus-visible {
  background: var(--color-background, #f8f9fa);
  outline: none;
}

.cicosy-tab-overflow-item.is-active {
  color: var(--color-primary, #0052cc);
  font-weight: 600;
}

/* Report / AR multi-row tab stacks need room for the floating More menu. */
.cicosy-report-library-recipe,
.cicosy-report-library-recipe .cicosy-invoice-page,
.cicosy-receivable-invoice-recipe .cicosy-invoice-page,
.cicosy-payable-invoice-recipe .cicosy-invoice-page {
  overflow: visible;
}

.cicosy-report-library-recipe .cicosy-invoice-page > section,
.cicosy-receivable-invoice-recipe .cicosy-invoice-page > section,
.cicosy-payable-invoice-recipe .cicosy-invoice-page > section {
  position: relative;
  z-index: 1;
}

.cicosy-report-library-recipe .cicosy-invoice-page > section:has(.cicosy-tab-overflow.is-open),
.cicosy-receivable-invoice-recipe .cicosy-invoice-page > section:has(.cicosy-tab-overflow.is-open),
.cicosy-payable-invoice-recipe .cicosy-invoice-page > section:has(.cicosy-tab-overflow.is-open) {
  z-index: 30;
}

/* AR invoice list: keep table-shell overflow-x scrolling; menus portal to body. */
.cicosy-receivable-invoice-recipe .cicosy-invoice-c-actions {
  min-width: 8.5rem;
  width: auto;
  overflow: visible;
}

/* Invoice / cashbook Full Screen: fill the viewport and fit line tables (no inner scroll). */
.is-workspace-fullscreen,
:fullscreen {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: none;
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--color-surface, #fff);
  padding: var(--spacing-md, 1rem);
}

.is-workspace-fullscreen > *:not(.ui-autocomplete):not(dialog):not(.cicosy-invoice-context-menu),
:fullscreen > *:not(.ui-autocomplete):not(dialog):not(.cicosy-invoice-context-menu) {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.is-workspace-fullscreen > .ui-autocomplete,
:fullscreen > .ui-autocomplete {
  width: auto;
  max-width: min(24rem, 100%);
  z-index: 4000;
}

.is-workspace-fullscreen > .cicosy-invoice-context-menu,
:fullscreen > .cicosy-invoice-context-menu {
  width: auto;
  max-width: min(16rem, 100%);
}

.is-workspace-fullscreen article,
.is-workspace-fullscreen .cicosy-form-layout-sectioned,
:fullscreen article,
:fullscreen .cicosy-form-layout-sectioned {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: visible;
  max-height: none;
}

.is-workspace-fullscreen .cicosy-data-table,
.is-workspace-fullscreen .cicosy-invoice-table-shell,
:fullscreen .cicosy-data-table,
:fullscreen .cicosy-invoice-table-shell {
  width: 100% !important;
  max-width: 100% !important;
  overflow: visible !important;
  overflow-x: hidden !important;
  overflow-y: visible !important;
  max-height: none !important;
}

.is-workspace-fullscreen .cicosy-invoice-table-shell table,
.is-workspace-fullscreen table.cicosy-table,
.is-workspace-fullscreen table.ar-invoice-lines,
.is-workspace-fullscreen table.ar-credit-lines,
.is-workspace-fullscreen table.ap-invoice-lines,
.is-workspace-fullscreen table.ap-grv-lines,
.is-workspace-fullscreen table.ap-credit-lines,
.is-workspace-fullscreen table.ap-debit-lines,
.is-workspace-fullscreen table.quote-lines,
.is-workspace-fullscreen table.ar-customer-journal-lines,
.is-workspace-fullscreen table.ap-supplier-journal-lines,
.is-workspace-fullscreen table.ar-recurring-lines,
.is-workspace-fullscreen table.je-journal-lines,
:fullscreen .cicosy-invoice-table-shell table,
:fullscreen table.cicosy-table,
:fullscreen table.ar-invoice-lines,
:fullscreen table.ar-credit-lines,
:fullscreen table.ap-invoice-lines,
:fullscreen table.ap-grv-lines,
:fullscreen table.ap-credit-lines,
:fullscreen table.ap-debit-lines,
:fullscreen table.quote-lines,
:fullscreen table.ar-customer-journal-lines,
:fullscreen table.ap-supplier-journal-lines,
:fullscreen table.ar-recurring-lines,
:fullscreen table.je-journal-lines {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  table-layout: fixed;
}

.is-workspace-fullscreen .cicosy-invoice-table-shell th,
.is-workspace-fullscreen .cicosy-invoice-table-shell td,
:fullscreen .cicosy-invoice-table-shell th,
:fullscreen .cicosy-invoice-table-shell td {
  min-width: 0 !important;
  max-width: none;
  white-space: normal !important;
  overflow-wrap: anywhere;
  word-break: break-word;
  vertical-align: top;
}

.is-workspace-fullscreen .cicosy-invoice-table-shell .form-control,
.is-workspace-fullscreen .cicosy-invoice-table-shell .form-select,
.is-workspace-fullscreen .cicosy-invoice-table-shell .cicosy-form-control,
.is-workspace-fullscreen .cicosy-invoice-table-shell .cicosy-form-select,
:fullscreen .cicosy-invoice-table-shell .form-control,
:fullscreen .cicosy-invoice-table-shell .form-select,
:fullscreen .cicosy-invoice-table-shell .cicosy-form-control,
:fullscreen .cicosy-invoice-table-shell .cicosy-form-select {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box;
}

.is-workspace-fullscreen .cicosy-invoice-table-shell .d-flex,
:fullscreen .cicosy-invoice-table-shell .d-flex {
  flex-wrap: wrap !important;
  min-width: 0;
  max-width: 100%;
}

.is-workspace-fullscreen .cicosy-invoice-table-shell .cicosy-btn,
:fullscreen .cicosy-invoice-table-shell .cicosy-btn {
  flex: 1 1 auto;
  min-width: 0;
}
