/**
 * Global typography — Montserrat + unified rem scale
 * Loaded after Metronic bundles so these overrides win.
 */

:root,
[data-bs-theme="light"],
[data-bs-theme="dark"] {
    --bs-font-sans-serif: "Montserrat", Helvetica, Arial, sans-serif;
    --bs-body-font-family: var(--bs-font-sans-serif);
    --bs-heading-font-family: var(--bs-font-sans-serif);

    /* Unified type scale (rem). Base = 16px. */
    --app-fs-10: 0.625rem;   /* 10px — rare micro */
    --app-fs-9: 0.75rem;     /* 12px — captions / tiny meta */
    --app-fs-8: 0.8125rem;   /* 13px — helper / badges */
    --app-fs-7: 0.875rem;    /* 14px — labels, muted, breadcrumbs */
    --app-fs-6: 1rem;        /* 16px — body / tables */
    --app-fs-base: 1rem;     /* 16px */
    --app-fs-5: 1.125rem;    /* 18px — subheads / card titles */
    --app-fs-4: 1.25rem;     /* 20px — section titles */
    --app-fs-3: 1.375rem;    /* 22px — page headings */
    --app-fs-2: 1.5rem;      /* 24px */
    --app-fs-1: 1.75rem;     /* 28px */
    --app-fs-2x: 2rem;       /* 32px — KPI numbers */
    --app-fs-2qx: 2.25rem;   /* 36px */
    --app-fs-3x: 2.5rem;     /* 40px */
    --app-fs-4x: 3rem;       /* 48px */
    --app-fs-5x: 3.5rem;     /* 56px */

    --bs-body-font-size: var(--app-fs-6);
    --bs-body-font-weight: 400;
    --bs-body-line-height: 1.5;
    --bs-headings-font-weight: 600;
}

html,
body,
button,
input,
select,
textarea,
.form-control,
.form-select,
.btn,
.menu,
.nav,
.table,
.card,
.modal,
.dropdown-menu,
.badge,
.breadcrumb,
.app-sidebar,
.app-header {
    font-family: var(--bs-font-sans-serif) !important;
}

body {
    font-size: var(--app-fs-6);
    font-weight: 400;
    letter-spacing: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6,
.page-heading,
.card-title,
.modal-title {
    font-family: var(--bs-font-sans-serif) !important;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* Unified Metronic fs-* utilities (fixed rem — no viewport calc drift) */
.fs-10 { font-size: var(--app-fs-10) !important; }
.fs-9  { font-size: var(--app-fs-9) !important; }
.fs-8  { font-size: var(--app-fs-8) !important; }
.fs-7  { font-size: var(--app-fs-7) !important; }
.fs-6  { font-size: var(--app-fs-6) !important; }
.fs-base { font-size: var(--app-fs-base) !important; }
.fs-5  { font-size: var(--app-fs-5) !important; }
.fs-4  { font-size: var(--app-fs-4) !important; }
.fs-3  { font-size: var(--app-fs-3) !important; }
.fs-2  { font-size: var(--app-fs-2) !important; }
.fs-1  { font-size: var(--app-fs-1) !important; }
.fs-2x { font-size: var(--app-fs-2x) !important; }
.fs-2qx { font-size: var(--app-fs-2qx) !important; }
.fs-3x { font-size: var(--app-fs-3x) !important; }
.fs-4x { font-size: var(--app-fs-4x) !important; }
.fs-5x { font-size: var(--app-fs-5x) !important; }

/* Common UI surfaces — keep readable defaults */
.table,
.table td,
.table th {
    font-size: var(--app-fs-6);
}

.menu-title,
.menu-link,
.nav-link {
    font-size: var(--app-fs-7);
}

.btn {
    font-size: var(--app-fs-7);
    font-weight: 600;
}

.form-control,
.form-select,
.form-label {
    font-size: var(--app-fs-7);
}

.badge {
    font-size: var(--app-fs-8);
    font-weight: 600;
}

.breadcrumb,
.breadcrumb-item {
    font-size: var(--app-fs-7);
}

.text-muted,
.form-text,
.hint,
.small {
    font-size: inherit;
}

/* Page chrome */
.page-heading {
    font-size: var(--app-fs-3) !important;
    font-weight: 700;
}

.card-title {
    font-size: var(--app-fs-5);
}

.modal-title {
    font-size: var(--app-fs-4);
}

/* Sidebar / header */
.app-sidebar-menu .menu-title {
    font-size: var(--app-fs-7);
    font-weight: 500;
}

.app-header {
    font-size: var(--app-fs-7);
}

/* Code / previews stay monospace but inherit size scale */
pre, code, .rfp-pane {
    font-size: var(--app-fs-7);
}

pre code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
}
