/* Screen typography only. Print styles remain authoritative. */
@media screen {
    body.app-typography {
        --app-ui-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    }

    /* Do not replace icon fonts, code samples or isolated document previews. */
    body.app-typography :is(h1, h2, h3, h4, h5, h6, p, a, li, label, input, select, textarea, button, td, th, dt, dd, legend, small, strong, b, span, div):not(:where(
        .fa, .fas, .far, .fab, .fal, .fad, .fa-solid, .fa-regular, .fa-brands,
        [class^="fa-"], [class*=" fa-"], [class^="ri-"], [class*=" ri-"],
        [class^="flaticon-"], [class*=" flaticon-"], [class^="ti-"], [class*=" ti-"],
        [class^="la-"], [class*=" la-"], .la, .las, .lar, .lab, .material-icons,
        [class^="icon-"], [class*=" icon-"], .glyphicon, .mdi, [class^="zmdi"],
        pre, pre *, code, code *, kbd, kbd *, samp, samp *,
        .inv-page, .inv-page *, [data-preserve-typography], [data-preserve-typography] *
    )) {
        font-family: var(--app-ui-font) !important;
        font-kerning: normal;
        font-optical-sizing: auto;
    }

    body.app-typography :is(h1, h2, h3, h4, h5, h6, .card-title, .modal-title):not(.inv-page *) {
        font-weight: 700;
    }

    /* Align accounting digits without forcing numbers to wrap or changing
       column widths, row heights, padding or the user's existing font sizes. */
    body.app-typography :is(td, input[type="number"], .inv-summary-value, .cr-totals-val) {
        font-variant-numeric: lining-nums tabular-nums;
    }

    /* Create and edit forms share this baseline, including before the
       typography script initializes and when legacy page styles are present. */
    body.app-typography #main-wrapper :is(.form-control, .form-select, label, table td, table th):not(:where(
        .invoice-wrapper *, .inv-page *, [data-preserve-typography] *
    )) {
        font-size: 16px !important;
        font-weight: 600 !important;
        line-height: 1.5;
    }
    body.app-typography #main-wrapper :is(label, table th):not(:where(
        .invoice-wrapper *, .inv-page *, [data-preserve-typography] *
    )) {
        font-weight: 700 !important;
    }
    body.app-typography #main-wrapper [data-readable-text],
    body.app-typography [data-readable-text] {
        font-size: var(--app-readable-size) !important;
        font-weight: var(--app-readable-weight) !important;
    }
    body.app-typography :is(input, select, textarea, button)[data-readable-text] {
        min-height: 2.5em;
    }

    /* Select2 renders its dropdown outside the form. Cover both the selected
       value and the detached results, including custom product templates. */
    body.app-typography :is(.select2-container, .select2-dropdown, .bootstrap-select) :is(
        .select2-selection__rendered, .select2-selection__choice, .select2-results__option,
        .select2-search__field, .filter-option-inner-inner, .dropdown-item,
        .select2-results__option span, .select2-results__option div,
        .select2-selection__rendered span, .select2-selection__rendered div
    ) {
        font-size: 16px !important;
        font-weight: 600 !important;
    }
    body.app-typography .select2-container .select2-selection--single {
        min-height: 44px;
        height: auto !important;
    }
    body.app-typography .select2-container .select2-selection--single .select2-selection__rendered {
        line-height: 1.5 !important;
        padding-top: 9px;
        padding-bottom: 9px;
        padding-right: 28px;
        white-space: normal !important;
        overflow-wrap: anywhere;
    }
    body.app-typography .select2-container .select2-selection--single .select2-selection__arrow {
        top: 50%;
        transform: translateY(-50%);
    }
    body.app-typography .select2-results__option {
        line-height: 1.5;
        overflow-wrap: anywhere;
    }
    body.app-typography .select2-search__field {
        min-height: 40px;
    }
    body.app-typography :is(td,th)[data-readable-text] {
        line-height: 1.5;
        vertical-align: middle;
    }
    body.app-typography input[data-readable-text]::placeholder,
    body.app-typography textarea[data-readable-text]::placeholder {
        font-size: inherit;
        font-weight: 400;
    }
}
