/* Shared density layer. Screen-only; no zoom, hidden fields, DOM changes or business behavior. */
@media screen {
    html body.erp-formal-theme {
        --erp-control-height:38px;
        --erp-table-control-height:34px;
        --erp-list-action-height:30px;
        --erp-field-gap:14px;
        --erp-panel-padding:16px;
    }

    /* Keep readable text and existing field widths; reclaim padding instead. */
    html body.erp-formal-theme :is(article.content,.modal,.erp-record-overlay) :is(input.form-control,input.custom-input,select.form-select,button.searchable-select-trigger):not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]) {
        min-height:var(--erp-control-height)!important;
        padding-block:6px!important;
        line-height:1.45;
    }
    html body.erp-formal-theme :is(article.content,.modal,.erp-record-overlay) textarea.form-control {
        min-height:72px;
        padding-block:7px;
    }
    html body.erp-formal-theme :is(article.content,.modal,.erp-record-overlay) .form-label {
        margin-bottom:5px!important;
        line-height:1.55;
    }
    html body.erp-formal-theme :is(article.content,.modal,.erp-record-overlay) .btn:where(:not(.erp-create-button,.btn-action,.pos-product-card)) {
        min-height:var(--erp-control-height)!important;
        padding-block:6px!important;
    }
    html body.erp-formal-theme :is(article.content,.modal,.erp-record-overlay) .input-group-text { padding-block:5px; }

    html body.erp-formal-theme .erp-content-scroll > article.content { padding:18px 20px 24px!important; }
    html body.erp-formal-theme article.content .erp-page-header:not(.document-list-heading):not(.erp-list-context-heading) {
        min-height:64px;
        padding:12px 18px!important;
        margin-bottom:14px;
        gap:10px;
    }
    html body.erp-formal-theme article.content .erp-page-header .page-icon-wrapper { width:38px; height:38px; flex-basis:38px; }
    html body.erp-formal-theme article.content :is(.card > .card-header,.erp-card > .card-header,.dashboard-panel__header) {
        min-height:44px;
        padding:10px 16px!important;
    }
    html body.erp-formal-theme article.content :is(.card.erp-card,.master-data-editor) > .card-header { min-height:44px; padding:10px 16px!important; }
    html body.erp-formal-theme article.content .card.screen-control-card:not(.master-data-editor) > .card-body:not(.p-0) {
        padding:var(--erp-panel-padding)!important;
    }
    html body.erp-formal-theme article.content .erp-data-list-card > .card-body:not(.p-0) { padding:12px!important; }
    html body.erp-formal-theme .screen-field-grid,
    html body.erp-formal-theme .master-form-grid { gap:var(--erp-field-gap); }
    html body.erp-formal-theme .screen-section-heading { padding-top:12px; }
    html body.erp-formal-theme .screen-form-actions {
        gap:8px; padding-block:12px 2px!important; margin-top:12px!important;
    }
    html body.erp-formal-theme .screen-form-actions > .btn { min-width:108px; }
    html body.erp-formal-theme .screen-switch { min-height:var(--erp-control-height); gap:8px; padding:8px 10px!important; }
    html body.erp-formal-theme :is(.screen-editor-tabs,.system-settings-tabs) { gap:6px!important; padding-bottom:10px!important; }
    html body.erp-formal-theme :is(.screen-editor-tabs > .btn,.system-settings-tabs .nav-link) {
        min-height:var(--erp-control-height); padding:6px 12px!important;
    }

    /* Accounting definitions, customers and suppliers use the same density. */
    html body.erp-formal-theme article.content .master-data-editor > .card-body { padding:16px 18px 0!important; }
    html body.erp-formal-theme .master-form-section { padding:14px; margin-bottom:14px; }
    html body.erp-formal-theme .master-form-intro { margin-bottom:12px; }
    html body.erp-formal-theme .master-section-hint { margin-bottom:12px; }
    html body.erp-formal-theme .master-field-hint { margin-top:4px; }
    html body.erp-formal-theme :is(.master-company-value,.master-type-choice) { min-height:var(--erp-control-height); }
    html body.erp-formal-theme .master-company-value { padding-block:6px; }
    html body.erp-formal-theme .master-switch { min-height:64px; padding:10px 12px; gap:10px; }
    html body.erp-formal-theme .master-form-actions { padding:12px 0; gap:8px; }
    html body.erp-formal-theme .master-form-actions .btn { min-width:108px; }
    html body.erp-formal-theme .master-form-note { padding:10px 12px; }
    html body.erp-formal-theme .master-link-body { padding:12px; }

    /* Compact rows without narrowing descriptions, names, amounts or barcode columns. */
    html body.erp-formal-theme article.content table:not(.internal-report-viewer table) :is(th,td) {
        padding:6px 10px!important;
    }
    html body.erp-formal-theme :is(article.content,.modal,.erp-record-overlay) table :is(input.form-control,select.form-select,button.searchable-select-trigger):not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]) {
        min-height:var(--erp-table-control-height)!important;
        padding-block:4px!important;
    }
    html body.erp-formal-theme article.content table .btn:where(:not(.erp-create-button,.btn-action)) {
        min-height:var(--erp-table-control-height)!important;
        padding-block:4px!important;
    }
    html body.erp-formal-theme article.content .erp-data-list-card table .btn:where(:not(.erp-create-button,.btn-action)) {
        min-height:var(--erp-list-action-height)!important; padding-block:3px!important;
    }
    html body.erp-formal-theme article.content .erp-list-toolbar .table-print-button { min-height:var(--erp-table-control-height)!important; padding-block:4px!important; }
    html body.erp-formal-theme .screen-table-tools { gap:8px; padding-block:10px; }
    html body.erp-formal-theme .screen-table-tools > .table-search-box { min-height:var(--erp-control-height); }
    html body.erp-formal-theme article.content .btn-action { width:32px; height:32px; min-height:32px; }

    /* Dialogs, settings and dashboards retain their layout and data hierarchy. */
    html body.erp-formal-theme :is(.modal,.erp-record-overlay) :is(.modal-header,.modal-footer) { padding:12px 16px; gap:8px; }
    html body.erp-formal-theme :is(.modal,.erp-record-overlay) .modal-body { padding:16px; }
    html body.erp-formal-theme .erp-record-fields { gap:10px; }
    html body.erp-formal-theme .settings-content { padding:16px; }
    html body.erp-formal-theme .settings-navigation { padding:10px 14px; }
    html body.erp-formal-theme .settings-content-heading { margin-bottom:12px; }
    html body.erp-formal-theme :is(.workspace-command-hero,.finance-hero,.people-hero) { padding:24px; gap:20px; }
    html body.erp-formal-theme article.content .dashboard-hero { padding:22px; min-height:120px; }
    html body.erp-formal-theme article.content .dashboard-kpi { padding:16px; min-height:126px; }
    html body.erp-formal-theme article.content .dashboard-action { padding:12px 16px; min-height:64px; gap:10px; }

    /* POS keeps full product names and touch-friendly selling actions. */
    html body.erp-formal-theme .pos-header { padding:12px 16px; gap:10px; margin-bottom:10px; }
    html body.erp-formal-theme .pos-context-bar,
    html body.erp-formal-theme .restaurant-order-strip { padding:8px; gap:8px; margin-bottom:10px; }
    html body.erp-formal-theme .pos-products-panel { padding:10px; }
    html body.erp-formal-theme .pos-workspace { gap:10px; }
    html body.erp-formal-theme .pos-product-grid { gap:6px; }
    html body.erp-formal-theme .pos-cart-header { padding:10px 12px; }
    html body.erp-formal-theme article.content .pos-cart-table :is(th,td) { padding:5px 6px!important; }
    html body.erp-formal-theme .login-pane { padding:32px 38px; }
    html body.erp-formal-theme .cyber-input,
    html body.erp-formal-theme .cyber-btn { min-height:46px; }

    /* Do not reduce hit targets on phones or touch terminals. */
    @media (max-width:767.98px), (pointer:coarse) {
        html body.erp-formal-theme { --erp-control-height:44px; --erp-table-control-height:44px; --erp-list-action-height:44px; --erp-field-gap:12px; --erp-panel-padding:12px; }
        html body.erp-formal-theme article.content .btn-action { width:44px; height:44px; min-height:44px; }
        html body.erp-formal-theme article.content .erp-create-button { width:44px!important; min-width:44px!important; max-width:44px; height:44px!important; min-height:44px!important; flex-basis:44px!important; }
        html body.erp-formal-theme :is(.table-search-box,.erp-list-toolbar .table-search-box) { min-height:44px; height:auto; }
        html body.erp-formal-theme .erp-list-toolbar .table-row-limit select { min-height:44px; }
        html body.erp-formal-theme :is(.pos-shortcuts-bar,.pos-payment-options) button { min-height:44px; }
        html body.erp-formal-theme .pos-edit-body .pos-quantity-control { height:46px; }
        html body.erp-formal-theme .pos-quantity-control button { width:44px; }
        html body.erp-formal-theme .pos-edit-dialog > header > button { width:44px; height:44px; }
        html body.erp-formal-theme .settings-workspace :is(input.form-control,select.form-select) { height:auto; }
    }
    @media (max-width:767.98px) {
        html body.erp-formal-theme .erp-content-scroll > article.content { padding:12px 10px 18px!important; }
        html body.erp-formal-theme article.content .erp-page-header:not(.document-list-heading):not(.erp-list-context-heading) { padding:12px!important; margin-bottom:12px; }
        html body.erp-formal-theme article.content .master-data-editor > .card-body { padding:12px 10px 0!important; }
        html body.erp-formal-theme .master-form-section { padding:12px 10px; }
        html body.erp-formal-theme :is(.screen-form-actions,.master-form-actions) > .btn { min-width:0; }
        html body.erp-formal-theme :is(.workspace-command-hero,.finance-hero,.people-hero) { padding:18px; gap:16px; }
        html body.erp-formal-theme .login-pane { padding:24px 20px; }
    }
}
