/* Shared ERP presentation. Page layouts and business state remain module-owned. */
:root {
    --erp-space: 4px;
    --erp-panel-padding: 16px;
    --erp-control-radius: 4px;
    --erp-panel-radius: 6px;
    --erp-control-height: 36px;
    --erp-form-panel-padding: 12px;
    --erp-form-row-gap: 8px;
    --erp-form-column-gap: 12px;
    --erp-form-label-gap: 4px;
    --erp-form-control-height: 32px;
    --erp-form-control-padding-y: 4px;
    --erp-form-control-padding-x: 8px;
    --erp-table-padding-y: 6px;
    --erp-table-padding-x: 8px;
    --erp-heading-weight: var(--user-heading-weight, 700);
    --theme-bg: #f3f6fb;
    --theme-surface: #ffffff;
    --theme-surface-strong: #ffffff;
    --theme-surface-muted: #f8fafc;
    --theme-surface-soft: #f8fafc;
    --theme-border: #d9dee7;
    --theme-border-strong: #aab5c4;
    --theme-text: #152033;
    --theme-text-soft: #2f3d52;
    --theme-text-muted: #64748b;
    --theme-shadow: none;
    --theme-shadow-soft: none;
    --theme-accent: var(--user-accent, #0f6c7b);
    --theme-accent-strong: var(--user-accent-text, #124d55);
    --theme-accent-soft: var(--user-accent-soft, rgb(15 108 123 / 0.12));
    --erp-primary-hover: var(--user-accent-hover, #0b5360);
    --erp-primary-on: var(--user-accent-on, #ffffff);
    --erp-focus: var(--user-accent-focus, #0f6c7b);
    --bs-body-font-family: var(--app-font-sans);
    --bs-body-font-size: var(--app-font-size-14);
    --bs-border-radius: var(--erp-control-radius);
    --bs-border-radius-lg: var(--erp-panel-radius);
    --bs-border-radius-sm: var(--erp-control-radius);
    --bs-body-bg: var(--theme-bg);
    --bs-body-color: var(--theme-text);
    --bs-border-color: var(--theme-border);
    --bs-link-color: var(--theme-accent-strong);
}
html[data-theme="dark"] {
    --theme-bg: #0e141b;
    --theme-surface: #111827;
    --theme-surface-strong: #111827;
    --theme-surface-muted: #182233;
    --theme-surface-soft: #182233;
    --theme-border: #2a3544;
    --theme-border-strong: #64748b;
    --theme-text: #e2e8f0;
    --theme-text-soft: #cbd5e1;
    --theme-text-muted: #94a3b8;
    --theme-shadow: none;
    --theme-shadow-soft: none;
    --theme-accent: var(--user-accent, #14b8a6);
    --theme-accent-strong: var(--user-accent-text, #5eead4);
    --theme-accent-soft: var(--user-accent-soft, rgb(20 184 166 / 0.14));
    --erp-primary-hover: var(--user-accent-hover, #2dd4bf);
    --erp-primary-on: var(--user-accent-on, #001b18);
    --erp-focus: var(--user-accent-focus, #5eead4);
}
html body {
    background: var(--theme-bg);
    color: var(--theme-text);
    font-family: var(--app-font-sans);
    font-size: var(--app-font-size-14);
    font-weight: var(--app-font-weight-regular);
    line-height: 1.5;
}
html body :is(h1, h2, h3, h4, h5, h6, .app-display-font) {
    font-family: var(--app-font-sans) !important;
    font-weight: var(--erp-heading-weight) !important;
    letter-spacing: normal !important;
}
html body h1 { font-size: var(--app-font-size-24) !important; }
html body :is(h2, h3) { font-size: var(--app-font-size-18) !important; }
html body :is(h4, h5, h6) { font-size: var(--app-font-size-14) !important; }
html :is(button, input, select, textarea) { font-family: var(--app-font-sans); }
html :is(table, .list-stat strong, .health-stat strong, .home-command-key) { font-variant-numeric: tabular-nums; }
html body :is(input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea) {
    min-height: var(--erp-control-height);
    font-family: var(--app-font-sans);
    font-size: var(--app-font-size-14);
}

/* Bootstrap and the shared form widgets use the same surfaces and metrics. */
html[data-theme] body[class] :is(.btn, .form-control, .form-select, .per-page-select, .search-input, .apply-search-input, .app-date-picker-input, .ns-input) {
    min-height: var(--erp-control-height);
    border-radius: var(--erp-control-radius) !important;
    font-size: var(--app-font-size-14);
    box-shadow: none;
}
html body :is(.form-control, .form-select, .per-page-select, .search-input, .apply-search-input, .ns-input) {
    background-color: var(--theme-surface-strong);
    color: var(--theme-text);
    border-color: var(--theme-border-strong);
}
html body :is(.form-control, .search-input, .apply-search-input, .ns-input)::placeholder { color: var(--theme-text-muted); opacity: 1; }
html[data-theme] body[class] :is(.btn-primary, .btn-dark, .login-btn, .login-popup-button, .error-btn-primary, .under-btn-primary, .app-auto-logout-btn, .bi-rate-submit, .admin-primary-button, .admin-topbar-link.is-primary, .period-button:not(.is-warning):not(.is-danger):not(.is-secondary)) {
    background: var(--theme-accent) !important;
    border-color: var(--theme-accent) !important;
    color: var(--erp-primary-on) !important;
    box-shadow: none !important;
}
html[data-theme] body[class] :is(.btn-primary, .btn-dark, .login-btn, .login-popup-button, .error-btn-primary, .under-btn-primary, .app-auto-logout-btn, .bi-rate-submit, .admin-primary-button, .admin-topbar-link.is-primary, .period-button:not(.is-warning):not(.is-danger):not(.is-secondary)):hover {
    background: var(--erp-primary-hover) !important;
    border-color: var(--erp-primary-hover) !important;
}
html body :is(.btn-outline-secondary, .btn-secondary) {
    background: var(--theme-surface-strong);
    color: var(--theme-text-soft);
    border-color: var(--theme-border-strong);
}
html body :is(.btn-outline-secondary, .btn-secondary):hover { background: var(--theme-surface-muted); color: var(--theme-text); }
html body :is(.modal-content, .offcanvas, .dropdown-menu, .card) {
    background: var(--theme-surface-strong);
    color: var(--theme-text);
    border-color: var(--theme-border);
    border-radius: var(--erp-panel-radius);
    box-shadow: none;
}
html body :is(.modal-header, .modal-body, .modal-footer, .card-body) { padding: var(--erp-panel-padding); }
html body :is(.modal-header, .modal-footer) { background: var(--theme-surface-strong); border-color: var(--theme-border); }
html body :is(.modal-title, .offcanvas-title) { font-size: var(--app-font-size-18); }
html body .dropdown-item { color: var(--theme-text); }
html body .dropdown-item:hover { background: var(--theme-surface-muted); }
html body .dropdown-item:disabled { color: var(--theme-text-muted); }
/* One text hierarchy across navigation, filters, actions and registers. */
html[data-theme] body[class] :is(.workspace-module-trigger, .workspace-destination, .workspace-control, .btn, .per-page-label, .transaction-filter-field > span, .form-label, .setup-field > span, .period-button, .period-solid-button, .admin-primary-button, .admin-secondary-button, .admin-danger-button) {
    font-size: var(--app-font-size-14) !important;
    font-weight: var(--app-font-weight-medium) !important;
    letter-spacing: normal !important;
}
html[data-theme] body[class] :is(.period-button, .period-solid-button, .admin-primary-button, .admin-secondary-button, .admin-danger-button) {
    min-height: var(--erp-control-height);
    border-radius: var(--erp-control-radius) !important;
}
html[data-theme] body[class] .period-page-shell .period-button.is-warning { color: var(--theme-warning) !important; }
html[data-theme] body[class] .period-page-shell .period-button.is-danger { color: var(--theme-danger) !important; }
html[data-theme] body[class] :is(.form-control, .form-select, .search-input, .per-page-select, .ns-input, .app-global-search-input) {
    font-size: var(--app-font-size-14) !important;
    font-weight: var(--app-font-weight-regular) !important;
    letter-spacing: normal;
}
html[data-theme] body[class] :is(.data-table, .table) td {
    font-size: var(--app-font-size-14) !important;
    font-weight: var(--app-font-weight-regular);
}
html[data-theme] body[class] :is(.data-table, .table) th {
    font-size: var(--app-font-size-12) !important;
    font-weight: var(--app-font-weight-medium) !important;
    letter-spacing: normal !important;
    text-transform: none;
}
html[data-theme] body[class] :is(.list-stat > span, .meta-pill, .status-badge, .list-eyebrow, .workspace-menu-heading, .workspace-caption) {
    font-size: var(--app-font-size-12) !important;
    font-weight: var(--app-font-weight-medium) !important;
    letter-spacing: normal !important;
    text-transform: none;
}
html[data-theme] body[class] :is(.page-btn.is-current, .app-date-picker-day.is-selected) {
    background: var(--theme-accent) !important;
    color: var(--erp-primary-on) !important;
}
html[data-theme] body[class] :is(.pdf-ocr-hero, .sku-match-hero, .app-bookmark-modal .modal-content) { color: var(--theme-text); }
html body .select2-container .select2-selection {
    min-height: var(--erp-control-height);
    border: 1px solid var(--theme-border-strong);
    border-radius: var(--erp-control-radius);
    background: var(--theme-surface-strong);
    color: var(--theme-text);
}
html body .select2-container .select2-selection__rendered { color: var(--theme-text); line-height: calc(var(--erp-control-height) - 2px); }
html body .select2-container .select2-selection__arrow { height: calc(var(--erp-control-height) - 2px); }
html body .select2-dropdown { border-color: var(--theme-border-strong); background: var(--theme-surface-strong); color: var(--theme-text); }
html body .select2-container .select2-results__option--highlighted[aria-selected] { background: var(--theme-accent); color: var(--erp-primary-on); }
html body :is(.select2-search__field) { background: var(--theme-surface-strong); color: var(--theme-text); }

/* Compact shared register headings and summaries. */
.workspace-shell .list-hero { padding: 16px; border: 1px solid var(--theme-border); border-radius: var(--erp-panel-radius); background: var(--theme-surface-strong); }
.workspace-shell .list-hero::before, .workspace-shell .list-hero::after { content: none; }
.workspace-shell .list-eyebrow { margin-bottom: 8px; font-size: var(--app-font-size-12); font-weight: 500; letter-spacing: normal; }
.workspace-shell .list-eyebrow::before { content: none; }
.workspace-shell .page-header { gap: 12px; align-items: center; }
.workspace-shell .page-title { font-size: var(--app-font-size-24); font-weight: var(--erp-heading-weight); letter-spacing: normal; }
.workspace-shell .page-subtitle { margin-top: 4px; font-size: var(--app-font-size-14); line-height: 1.5; }
/* One title-and-actions row for registers, forms, reports and utilities. */
.compact-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    width: 100%;
    min-width: 0;
    margin: 0;
}
.compact-page-header > .page-title {
    min-width: 0;
    margin: 0;
    font-size: var(--app-font-size-24);
    font-weight: var(--erp-heading-weight);
    line-height: 1.3;
    overflow-wrap: anywhere;
}
.compact-page-header > .page-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 0 auto;
    min-width: 0;
}
.admin-topbar > .compact-page-header { flex: 1; width: auto; }
.admin-topbar > .admin-topbar-copy { flex: 0 0 auto; min-width: 0; }
.transaction-title-heading { width: auto; }
.integration-page .integration-page-hero.compact-page-header {
    align-items: center;
    padding: 16px;
    color: var(--theme-text);
    border-color: var(--theme-border);
    background: var(--theme-surface-strong);
}
.integration-page .integration-page-hero.compact-page-header > .page-title {
    color: var(--theme-text);
}
.integration-page .integration-page-hero.compact-page-header :is(.btn-outline-light, .btn-outline-secondary, .btn-outline-primary) {
    color: var(--theme-text-soft);
    border-color: var(--theme-border-strong);
    background: var(--theme-surface-strong);
}
.integration-page > .integration-hero-metrics {
    width: 100%;
    border-color: var(--theme-border);
    color: var(--theme-text);
    background: var(--theme-surface-strong);
}
.integration-page > .integration-hero-metrics .integration-hero-metric :is(span, strong) {
    color: var(--theme-text);
}
.page-context {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 16px;
    min-width: 0;
    margin: 0;
    color: var(--theme-text-muted);
    font-size: var(--app-font-size-13);
    line-height: 1.5;
}
.page-context > :is(p, div) { margin: 0; }
.workspace-shell .list-shell > .list-stats { margin-top: 0; }
.period-command-hero.compact-hero { display: block; padding: 16px; }
.period-summary-surface { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 340px); gap: 16px; }
@media (max-width: 640px) {
    .compact-page-header,
    .workspace-shell .compact-page-header,
    .integration-page .integration-page-hero.compact-page-header { flex-direction: column; align-items: flex-start; }
    .compact-page-header > .page-actions { width: 100%; margin-left: 0; justify-content: flex-start; }
    .compact-page-header > .page-actions .btn { width: auto; max-width: 100%; }
    .period-summary-surface { grid-template-columns: minmax(0, 1fr); }
}
.workspace-shell .list-stats { gap: 12px; margin-top: 16px; }
.workspace-shell .list-stat { padding: 12px; min-height: 0; gap: 4px; border: 1px solid var(--theme-border); border-radius: var(--erp-panel-radius); background: var(--theme-surface-muted); }
.workspace-shell .list-stat strong { margin: 4px 0; font-size: var(--app-font-size-20); font-weight: var(--erp-heading-weight); letter-spacing: normal; line-height: 1.4; }
.workspace-shell .list-stat :is(span, small) { font-size: var(--app-font-size-12); }
.workspace-shell .list-surface { padding: 16px; border: 1px solid var(--theme-border); border-radius: var(--erp-panel-radius); background: var(--theme-surface-strong); }
.workspace-shell :is(.toolbar, .transaction-filter-panel, .table-card) { border-color: var(--theme-border); border-radius: var(--erp-panel-radius); background: var(--theme-surface-strong); }
.workspace-shell :is(.section-box, .detail-card, .sidebar-card, .description-card, .form-section, .setup-form, .finance-setup-panel, .sku-match-card, .home-panel, .home-widget-header, .home-widget-body, .home-widget-stage, .home-command-hero) {
    padding: var(--erp-panel-padding);
    border-color: var(--theme-border);
    border-radius: var(--erp-panel-radius);
    background: var(--theme-surface-strong);
}
.workspace-shell .toolbar { padding: 12px; gap: 12px; }
.workspace-shell .meta-pill { border-radius: var(--erp-control-radius); font-size: var(--app-font-size-12); }
.workspace-shell :is(.data-table, .table) { color: var(--theme-text); }
.workspace-shell :is(.data-table, .table) th { background: var(--theme-surface-muted); font-size: var(--app-font-size-12); font-weight: 600; }
.workspace-shell :is(.data-table, .table) :is(th, td) { border-color: var(--theme-border); }
.workspace-shell .transaction-filter-field > span { color: var(--theme-text-soft); }
.workspace-top-shell :is(.workspace-control, .workspace-icon-button, .workspace-dropdown, .app-global-search-input) { border-radius: var(--erp-control-radius); }
.workspace-top-shell .workspace-subsidiary-form .app-subsidiary-option { min-height: 44px; border-radius: var(--erp-control-radius); color: var(--theme-text); }
.workspace-top-shell .workspace-subsidiary-form .app-subsidiary-option.is-current { background: var(--theme-accent-soft); color: var(--theme-accent-strong); }
html[data-theme] body .bi-rate-fab { background: var(--theme-accent); color: var(--erp-primary-on); }
html[data-user-colors] body[class] .workspace-top-shell .workspace-module-trigger,
html[data-user-colors] body[class] .workspace-header :is(.workspace-brand, .workspace-control, .workspace-icon-button) { color: var(--user-navbar-on); }
html[data-user-colors] body[class] .workspace-top-shell .workspace-module-trigger:hover,
html[data-user-colors] body[class] .workspace-nav-group[open] > .workspace-module-trigger { color: var(--user-accent-on); }

/* Carbon administration keeps its layout and uses the application's palette. */
.admin-body {
    --admin-carbon-bg: var(--theme-bg);
    --admin-carbon-surface: var(--theme-surface-strong);
    --admin-carbon-surface-alt: var(--theme-surface-muted);
    --admin-carbon-surface-hover: var(--theme-surface-muted);
    --admin-carbon-border: var(--theme-border);
    --admin-carbon-border-strong: var(--theme-border-strong);
    --admin-carbon-text: var(--theme-text);
    --admin-carbon-muted: var(--theme-text-soft);
    --admin-carbon-subtle: var(--theme-text-muted);
    --admin-carbon-accent: var(--theme-accent);
    --admin-carbon-accent-hover: var(--erp-primary-hover);
    --cds-interactive: var(--theme-accent);
    --cds-link-primary: var(--theme-accent-strong);
    --cds-focus: var(--erp-focus);
    --cds-button-primary: var(--theme-accent);
    --cds-button-primary-hover: var(--erp-primary-hover);
    --cds-text-on-color: var(--erp-primary-on);
}
html body :is(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 2px solid var(--erp-focus) !important;
    outline-offset: 2px;
}

/* Density belongs to content and form dialogs, leaving navigation and dashboard
   layout metrics alone. Keep the shared control token local to these surfaces. */
:where(.app-main-content, .admin-content, .modal, .offcanvas, .bi-rate-form) {
    --erp-control-height: var(--erp-form-control-height);
}
html[data-theme] body[class] :where(.app-main-content, .admin-content, .modal, .offcanvas, .bi-rate-form)
:is(input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]), select, textarea) {
    min-height: max(var(--erp-control-height), calc(1.5em + 2 * var(--erp-form-control-padding-y) + 2px));
    padding-block: var(--erp-form-control-padding-y);
    padding-inline: var(--erp-form-control-padding-x);
    line-height: 1.5;
}
/* Native multiple selects and textareas retain their row-based height. */
html[data-theme] body[class] :where(.app-main-content, .admin-content, .modal, .offcanvas)
:is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]), select:not([multiple]):not([size])) {
    height: auto;
}
html[data-theme] body[class] :where(.app-main-content, .admin-content, .modal, .offcanvas)
:is(.form-select, .app-date-picker-input, .rate-input-shell .form-control) {
    padding-right: 2rem !important;
}
html[data-theme] body[class] :where(.app-main-content, .admin-content, .modal, .offcanvas)
:is(.btn, .period-button, .period-solid-button, .admin-primary-button, .admin-secondary-button, .admin-danger-button, .admin-submit-button, .apply-action-btn) {
    min-height: var(--erp-control-height);
    padding: var(--erp-form-control-padding-y) var(--erp-form-control-padding-x);
    line-height: 1.5;
}
html[data-theme] body[class] :where(.app-main-content, .admin-content, .modal, .offcanvas)
.input-group-text {
    padding: var(--erp-form-control-padding-y) var(--erp-form-control-padding-x);
}
html[data-theme] body[class] :where(.app-main-content, .admin-content, .modal, .offcanvas)
.select2-container .select2-selection {
    height: auto !important;
    min-height: var(--erp-control-height);
    font-size: var(--app-font-size-14);
}
html[data-theme] body[class] :where(.app-main-content, .admin-content, .modal, .offcanvas)
.select2-container .select2-selection--single {
    padding: 0;
    display: flex;
    align-items: center;
}
html[data-theme] body[class] :where(.app-main-content, .admin-content, .modal, .offcanvas)
.select2-container .select2-selection--single .select2-selection__rendered {
    width: 100%;
    line-height: 1.5 !important;
    padding: var(--erp-form-control-padding-y) 2rem var(--erp-form-control-padding-y) var(--erp-form-control-padding-x);
}
html[data-theme] body[class] :where(.app-main-content, .admin-content, .modal, .offcanvas)
.select2-container .select2-selection__arrow { height: 100% !important; top: 0; }
html[data-theme] body[class] :where(.app-main-content, .admin-content, .modal, .offcanvas)
.select2-container .select2-selection--multiple { padding: 0 var(--erp-form-control-padding-x); }
html[data-theme] body[class] .select2-container .select2-selection--multiple .select2-search__field {
    min-height: 0;
    padding: 0;
}

/* Explicit form grids preserve each module's columns and responsive breakpoints. */
html[data-theme] body[class] :is(.ns-grid, .form-grid, .setup-form-grid, .counterparty-form-grid,
    .p2p-grid, .otc-grid, .admin-form-grid, .period-form-grid, .period-filter-grid,
    .transaction-filter-grid, .transaction-filter-range, .tb-filter-grid, .pl-filter-grid,
    .bs-filter-grid, .cash-advance-filter-grid, .prepaid-filter-grid, .cfr-filter-grid,
    .gl-filter-grid, .gl-period-filter-row, .fifo-filter-grid, .integration-monitor-filter-grid,
    .integration-update-form-grid, .reconcile-statement-input-grid, .reconcile-history-filter-grid,
    .opbal-grid, .match-bank-quick-grid) {
    gap: var(--erp-form-row-gap) var(--erp-form-column-gap);
}
html[data-theme] body[class] :is(.field-group, .description-field, .setup-field, .counterparty-field,
    .transaction-filter-field, .admin-form-field, .admin-form-group, .period-form-field, .period-form-group, .period-filter-field,
    .opbal-field, .pdf-ocr-field, .sku-match-field, .integration-modal-field,
    .integration-run-detail-field, .match-bank-add-charge-field,
    .tb-filter-grid label, .pl-filter-grid label, .bs-filter-grid label,
    .prepaid-filter-grid label, .cash-advance-filter-grid label) { gap: var(--erp-form-label-gap); }
html[data-theme] body[class] :where(.ns-grid, .form-grid, .setup-form-grid, .p2p-grid, .otc-grid,
    .admin-form-grid, .period-form-grid, .modal form)
:is(.label, .form-label, .field-label, label:not(.form-check-label)) { margin-bottom: var(--erp-form-label-gap); }
/* Grid fields already supply the label gap; avoid adding a second margin. */
html[data-theme] body[class] :is(.field-group, .setup-field, .admin-form-field, .admin-form-group, .period-form-field, .period-form-group) > :is(label, .field-label) { margin-bottom: 0; }
html[data-theme] body[class] :where(.app-main-content, .admin-content, .modal, .offcanvas) form .row {
    --bs-gutter-x: var(--erp-form-column-gap);
    --bs-gutter-y: var(--erp-form-row-gap);
}
html[data-theme] body[class] :where(.app-main-content, .admin-content, .modal, .offcanvas) form :is(.mb-3, .mb-4, .mb-5) {
    margin-bottom: var(--erp-form-row-gap) !important;
}
html[data-theme] body[class] :is(.list-surface, .section-box, .form-section, .setup-form, .counterparty-form-card,
    .p2p-card, .otc-card, .transaction-filter-panel, .transaction-customization-card,
    .transaction-customization-section, .admin-form-card, .period-form-card,
    .tb-filter-panel, .pl-filter-panel, .bs-filter-panel, .modal-header, .modal-body, .modal-footer) {
    padding: var(--erp-form-panel-padding);
}
html[data-theme] body[class] :is(.section-box, .form-section, .p2p-card, .otc-card) { margin-bottom: var(--erp-form-row-gap); }
html[data-theme] body[class] :is(.section-title, .p2p-card > h2, .otc-card > h2) {
    margin-bottom: var(--erp-form-row-gap);
    padding-bottom: var(--erp-form-row-gap);
}
html[data-theme] body[class] :is(.toolbar, .transaction-list-toolbar, .setup-toolbar, .p2p-toolbar,
    .otc-toolbar, .apply-toolbar, .bill-approval-toolbar, .form-actions,
    .p2p-actions, .otc-actions, .transaction-filter-actions) {
    gap: var(--erp-form-row-gap) var(--erp-form-column-gap);
}
html[data-theme] body[class] :is(.toolbar, .transaction-filter-actions) { padding: var(--erp-form-row-gap); }
html[data-theme] body[class] :is(.apply-toolbar, .transaction-filter-actions) { margin-block: var(--erp-form-row-gap); }

html body select.select2-hidden-accessible {
    min-width: 0 !important;
    min-height: 0 !important;
}
html body :is(.p2p-table-wrap, .otc-table-wrap, .expenses-table-wrap, .table-scroll,
    .apply-table-shell, .admin-table-wrapper) { position: relative; }

/* All data-table families, including tables in modal bodies and admin pages.
   Spacer cells are excluded because their height drives report virtualization. */
html[data-theme] body[class] :where(.app-main-content, .admin-content, .modal, .offcanvas, .bi-rate-sidebar)
table > :is(thead, tbody, tfoot) > tr > :is(th, td):not(.pl-account-placeholder-cell) {
    padding: var(--erp-table-padding-y) var(--erp-table-padding-x) !important;
}
html[data-theme] body[class] :where(.app-main-content, .admin-content, .modal, .offcanvas)
:is(.td-name, .td-description, .td-memo, .gl-memo-cell, .system-information-change-table td) {
    white-space: normal;
    overflow-wrap: anywhere;
}
html[data-theme] body[class] :where(.app-main-content, .admin-content, .modal, .offcanvas)
:is(.td-currency, .td-mono, .apply-money-cell, .apply-date-cell) { white-space: nowrap; }

@media (max-width: 767.98px) {
    :root { --erp-control-height: 44px; --erp-form-control-height: 44px; }
    .workspace-shell .list-stats { grid-template-columns: minmax(0, 1fr); }
    .workspace-shell .transaction-view-select { min-width: 0; width: 100%; }
    .workspace-shell .transaction-view-form { width: 100%; }
    .workspace-shell .transaction-view-label { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    body :is(button, a, input, select, textarea, .modal, .offcanvas) { transition: none !important; }
}
