/*
 * Global typography contract for the management application.
 * Loaded after module styles so legacy pages share one readable baseline.
 */

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-sans, 'Roboto', 'Segoe UI', Arial, sans-serif);
    font-size: var(--font-size-body, 14px);
    line-height: 1.45;
}

/* Normalize text-bearing elements, including pages that declare Inter/Segoe UI locally. */
body :where(
    div, section, article, aside, header, footer, main, nav,
    p, span, a, ul, ol, li, dl, dt, dd,
    h1, h2, h3, h4, h5, h6,
    form, fieldset, legend, label,
    table, thead, tbody, tfoot, tr, th, td,
    button, input, select, textarea, option
) {
    font-family: var(--font-sans, 'Roboto', 'Segoe UI', Arial, sans-serif) !important;
}

body :where(button, input, select, textarea, option) {
    font-size: var(--font-size-control, 14px) !important;
    line-height: 1.35;
}

body :where(table, table th, table td) {
    font-size: var(--font-size-table, 13px) !important;
    line-height: 1.4;
}

body :where(
    label, small,
    [class$="-label"], [class*="-label "],
    [class$="-subtitle"], [class*="-subtitle "],
    [class$="-meta"], [class*="-meta "],
    [class$="-badge"], [class*="-badge "],
    [class$="-pill"], [class*="-pill "],
    [class$="-chip"], [class*="-chip "],
    [class$="-footer"], [class*="-footer "]
) {
    font-size: var(--font-size-caption, 12px) !important;
    line-height: 1.35;
}

/* Preserve fonts whose glyph mapping must not be replaced by Roboto. */
body :where(.material-icons) {
    font-family: 'Material Icons' !important;
}

body :where(.material-icons-round) {
    font-family: 'Material Icons Round' !important;
}

body :where(.material-symbols-outlined) {
    font-family: 'Material Symbols Outlined' !important;
}

body :where(.fa, .fas, .far, .fal, .fad, .fa-solid, .fa-regular) {
    font-family: 'Font Awesome 6 Free' !important;
}

body :where(.fab, .fa-brands) {
    font-family: 'Font Awesome 6 Brands' !important;
}

body :where(.rzi) {
    font-family: 'Material Symbols Outlined' !important;
}

body :where(.mdi) {
    font-family: 'Material Design Icons' !important;
}

body :where(code, pre, kbd, samp, .monospace, .mono, [class*="-mono"], [class*="code-sm"]),
body :where(code, pre, kbd, samp, .monospace, .mono, [class*="-mono"], [class*="code-sm"]) * {
    font-family: var(--font-mono, Consolas, monospace) !important;
}

body :where(.CodeMirror, .CodeMirror *, .ql-code-block-container, .ql-code-block) {
    font-family: var(--font-mono, Consolas, monospace) !important;
}

@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    body :where(button, input, select, textarea, option) {
        font-size: 14px !important;
    }

    body :where(table, table th, table td) {
        font-size: 13px !important;
    }
}
