/* Compact table settings and a draft-based, scrollable column picker. */
body.bb-app-active .bb-column-button { width: 38px; min-width: 38px; height: 38px; padding: 9px; color: #2877db; border: 1px solid transparent; background: transparent; box-shadow: none; border-radius: 6px; }
body.bb-app-active .bb-column-button:hover, body.bb-app-active .bb-column-button[aria-expanded="true"] { background: #edf4ff; border-color: #cbdcf4; }
.bb-column-button svg, .bb-column-menu svg, .bb-column-dialog svg { width: 18px; height: 18px; flex-shrink: 0; }
.bb-column-menu, dialog.bb-column-dialog { --cc-bg: #fff; --cc-ink: #202c40; --cc-muted: #667188; --cc-line: #e7e9ef; --cc-row: #f7f8fb; --cc-blue: #286be0; --cc-focus: #1c61da; color: var(--cc-ink); background: var(--cc-bg); font-family: inherit; font-size: 14px; font-weight: 400; }
.bb-column-menu { position: fixed; z-index: 12000; width: 220px; max-width: calc(100vw - 16px); padding: 4px; border: 1px solid var(--cc-line); border-radius: 7px; box-shadow: 0 6px 24px #18294724; }
.bb-column-menu button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 39px; padding: 8px 10px; border: 0; border-radius: 4px; background: transparent; color: var(--cc-ink); font: inherit; text-align: left; cursor: pointer; }
.bb-column-menu button svg { color: #3885ee; }
.bb-column-menu button:hover, .bb-column-menu button:focus-visible { background: var(--cc-blue); color: #fff; outline: none; }
.bb-column-menu button:hover svg, .bb-column-menu button:focus-visible svg { color: #fff; }
.bb-column-tick { margin-left: auto; }
dialog.bb-column-dialog { position: fixed; inset: 0; margin: auto; padding: 0; width: 556px; max-width: calc(100vw - 24px); max-height: min(760px, calc(100dvh - 48px)); border: 1px solid var(--cc-line); border-radius: 9px; box-shadow: 0 18px 65px #0b172e36; overflow: hidden; }
dialog.bb-column-dialog[open] { display: flex; flex-direction: column; }
dialog.bb-column-dialog::backdrop { background: #0f1b304d; }
.bb-column-head { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; min-height: 65px; padding: 16px 20px; background: var(--cc-row); border-bottom: 1px solid var(--cc-line); }
.bb-column-head h2 { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--cc-ink); font-size: 18px; font-weight: 500; line-height: 1.35; letter-spacing: 0; }
.bb-column-head [data-column-count] { margin-left: auto; font-size: 12px; white-space: nowrap; }
.bb-column-head .bb-column-close { border: 0; border-left: 1px solid var(--cc-line); border-radius: 0; background: transparent; padding: 0 0 0 12px; min-width: 30px; min-height: 30px; font-size: 24px; line-height: 1; color: #d82e42; cursor: pointer; }
.bb-column-body { display: flex; flex-direction: column; overflow: hidden; min-height: 0; padding: 20px 20px 0; }
.bb-column-search { display: flex; align-items: center; gap: 8px; min-height: 40px; flex: 0 0 auto; padding: 0 11px; border: 1px solid #cfd5e2; border-radius: 6px; color: var(--cc-muted); background: var(--cc-bg); }
.bb-column-search:focus-within { border-color: var(--cc-focus); box-shadow: 0 0 0 2px #286be020; }
.bb-column-dialog .bb-column-search input { width: 100%; min-width: 0; padding: 9px 0; border: 0; border-radius: 0; background: transparent; color: var(--cc-ink); box-shadow: none; outline: none; font: inherit; }
/* The surrounding field owns focus styling; suppress the application's global
   input treatment here to avoid two borders/rings, especially on mobile. */
html body.bb-app-active #bb-column-customizer .bb-column-search input {
  appearance: none; background: transparent !important; color: var(--cc-ink) !important;
  border: 0 !important; border-radius: 0 !important; outline: none !important;
  box-shadow: none !important; padding: 9px 0 !important; min-height: 0 !important;
  font-size: 14px !important; font-weight: 400 !important;
}
html body.bb-app-active #bb-column-customizer .bb-column-search input::placeholder { color: var(--cc-muted) !important; font-weight: 400 !important; opacity: 1; }
html body.bb-app-active #bb-column-customizer :is(.bb-column-label, .bb-column-choice span, .bb-column-help) { font-weight: 400 !important; }
html body.bb-app-active #bb-column-customizer .bb-column-head h2 { font-weight: 500 !important; }
html body.bb-app-active .bb-column-menu button:focus-visible { outline: none !important; box-shadow: none !important; }
.bb-column-help { margin: 10px 0 12px; color: var(--cc-muted); font-size: 12px; line-height: 1.5; }
.bb-column-list { overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; min-height: 0; padding: 0 6px 4px 0; }
.bb-column-row { display: flex; align-items: center; gap: 7px; min-height: 42px; padding: 5px 8px; margin-bottom: 6px; background: var(--cc-row); border: 1px solid transparent; border-radius: 5px; }
.bb-column-row:focus-within { border-color: #a9c7f3; }
.bb-column-dialog .bb-column-grip { display: grid; place-items: center; width: 15px; min-width: 15px; padding: 0; height: 30px; border: 0; background: transparent; color: var(--cc-muted); cursor: grab; }
.bb-column-grip svg { width: 12px; }
.bb-column-choice { display: flex; align-items: center; gap: 7px; flex: 1; min-width: 0; cursor: pointer; font-weight: 400; }
.bb-column-dialog .bb-column-choice input { flex: 0 0 16px; width: 16px; height: 16px; margin: 0; padding: 0; accent-color: var(--cc-blue); }
.bb-column-label, .bb-column-choice span { color: var(--cc-ink); font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.bb-column-label { flex: 1; }
.bb-column-lock { display: flex; width: 16px; color: var(--cc-muted); }
.bb-column-lock svg { width: 16px; height: 17px; }
.bb-column-move-buttons { display: flex; gap: 2px; opacity: 0; }
.bb-column-row:hover .bb-column-move-buttons, .bb-column-row:focus-within .bb-column-move-buttons { opacity: 1; }
.bb-column-dialog .bb-column-move-buttons button { width: 26px; height: 28px; padding: 0; border: 1px solid var(--cc-line); border-radius: 4px; color: var(--cc-muted); background: var(--cc-bg); cursor: pointer; }
.bb-column-dialog button:disabled { opacity: .35; cursor: default; }
.bb-column-empty { padding: 16px 0 28px; text-align: center; color: var(--cc-muted); }
.bb-column-footer { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; padding: 18px 20px; border-top: 1px solid var(--cc-line); background: var(--cc-bg); }
.bb-column-dialog .bb-column-footer button { min-height: 38px; padding: 8px 14px; border: 1px solid #d0d5df; border-radius: 5px; font: inherit; line-height: 1.4; background: var(--cc-row); color: var(--cc-ink); cursor: pointer; }
.bb-column-dialog .bb-column-footer .bb-column-save { background: var(--cc-blue); color: #fff; border-color: var(--cc-blue); }
.bb-column-dialog .bb-column-footer .bb-column-reset { margin-left: auto; border-color: transparent; color: var(--cc-muted); background: transparent; font-size: 12px; padding-inline: 4px; }
.bb-column-dialog button:focus-visible, body.bb-app-active .bb-column-button:focus-visible { outline: 2px solid #2877db; outline-offset: 2px; }
.bb-column-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
html[data-theme="dark"] .bb-column-menu, html[data-theme="dark"] dialog.bb-column-dialog { --cc-bg: #182235; --cc-ink: #e9eef8; --cc-muted: #aebbd1; --cc-line: #344158; --cc-row: #212d42; --cc-blue: #2f70de; --cc-focus: #76a7ff; }
html[data-theme="dark"] body.bb-app-active .bb-column-button { color: #8abbff; }
html[data-theme="dark"] body.bb-app-active .bb-column-button:hover, html[data-theme="dark"] body.bb-app-active .bb-column-button[aria-expanded="true"] { background: #233a5b; border-color: #385580; }
/* Both states are explicit: many older registers wrap by default, so removing
   the "on" rule alone cannot restore a compact row. Do not clip action menus,
   selection controls, empty states, or unrelated tables in a record view. */
html body.bb-app-active #app-shell table.bb-column-table[data-register-wrap="false"] > tbody > tr > td[data-column]:not([data-column="selection"]):not([data-column="actions"]):not([colspan]),
html body.bb-app-active #app-shell table.bb-column-table[data-register-wrap="false"] > tbody > tr > td[data-column]:not([data-column="actions"]):not([data-column="selection"]) :is(a, button, span, strong, small) {
  white-space: nowrap !important;
  overflow-wrap: normal !important;
  text-overflow: ellipsis !important;
  overflow: hidden;
}
html body.bb-app-active #app-shell table.bb-column-table[data-register-wrap="false"] > tbody > tr > td[data-column]:not([data-column="selection"]):not([data-column="actions"]):not([colspan]) { max-width: 280px; }
html body.bb-app-active #app-shell table.bb-column-table[data-register-wrap="false"] :is(.record-link, .qv-trigger, .bb-register-link, .item-name-button, .item-name-button strong) { min-width: 0; max-width: 100%; }
html body.bb-app-active #app-shell table.bb-column-table[data-register-wrap="true"] > tbody > tr > td[data-column]:not([data-column="selection"]):not([data-column="actions"]):not(.bb-register-number),
html body.bb-app-active #app-shell table.bb-column-table[data-register-wrap="true"] > tbody > tr > td[data-column]:not([data-column="actions"]):not([data-column="selection"]) :is(.record-link, .qv-trigger, .bb-register-link, .item-name-button, span, strong, small) {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  text-overflow: clip !important;
  -webkit-line-clamp: unset;
  max-height: none;
}
@media (max-width: 768px), (max-width: 1280px) and (pointer: coarse) {
  /* Sales Receipts' ID-specific desktop table rules otherwise override the
     installed-app cards and clip wrapped text outside the phone viewport. */
  html:is(.native-app-mode, .pwa-mode) body.bb-app-active #app-shell #salesreceipts table.bb-column-table,
  html:is(.native-app-mode, .pwa-mode) body.bb-app-active #app-shell #salesreceipts table.bb-column-table > :is(thead, tbody) {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  html:is(.native-app-mode, .pwa-mode) body.bb-app-active #app-shell #salesreceipts table.bb-column-table > tbody > tr:not([hidden]) {
    padding: 14px 38px 14px 40px !important;
  }
  html:is(.native-app-mode, .pwa-mode) body.bb-app-active #app-shell #salesreceipts table.bb-column-table > tbody > tr > td {
    display: block !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
  }
}
@media (max-width: 600px) {
  dialog.bb-column-dialog { max-height: calc(100dvh - 24px); }
  .bb-column-head { flex-wrap: wrap; gap: 8px; padding: 14px 16px; }
  .bb-column-head h2 { font-size: 17px; flex: 1; }
  .bb-column-head [data-column-count] { order: 3; width: 100%; margin-left: 28px; }
  .bb-column-body { padding: 14px 14px 0; }
  .bb-column-footer { padding: 14px; }
  .bb-column-move-buttons { opacity: 1; }
}
@media (pointer: coarse) { .bb-column-move-buttons { opacity: 1; } .bb-column-row { min-height: 48px; } }
