/* Totelman Standard Typography v5
   Purpose: restore readable desktop + mobile font sizing after compact theme/mobile patches.
   Scope: CSS/UI only. No payroll, commission, PNL, import, auth, role or database logic changed. */

:root {
    --tm-font-main: Calibri, "Segoe UI", Roboto, Arial, sans-serif;
    --tm-text-base: 16px;
    --tm-text-body: 1rem;          /* 16px */
    --tm-text-card: .97rem;        /* 15.5px */
    --tm-text-small: .875rem;      /* 14px */
    --tm-text-xs: .8125rem;        /* 13px */
    --tm-line-body: 1.5;
}

html {
    font-size: var(--tm-text-base) !important;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body,
body.glass-theme,
body.login-bg.glass-theme {
    font-family: var(--tm-font-main) !important;
    font-size: var(--tm-text-body) !important;
    line-height: var(--tm-line-body) !important;
    letter-spacing: 0 !important;
}

/* Standard text scale */
.glass-theme p,
.glass-theme li,
.glass-theme .text-muted,
.glass-theme .list-group-item,
.glass-theme .dropdown-item,
.glass-theme .dropdown-menu,
.glass-theme .alert,
.glass-theme .card,
.glass-theme .card-body {
    font-size: var(--tm-text-card) !important;
    line-height: 1.48 !important;
}

.glass-theme .small,
.glass-theme small,
.glass-theme .form-text,
.glass-theme .text-xs,
.glass-theme .dropdown-notifications-item-content-details,
.glass-theme .dropdown-notifications-item-content-text {
    font-size: var(--tm-text-small) !important;
    line-height: 1.4 !important;
}

/* Headings: readable, not oversized */
.glass-theme h1,
.glass-theme .h1 { font-size: 1.75rem !important; line-height: 1.2 !important; font-weight: 700 !important; }
.glass-theme h2,
.glass-theme .h2 { font-size: 1.5rem !important; line-height: 1.25 !important; font-weight: 700 !important; }
.glass-theme h3,
.glass-theme .h3 { font-size: 1.28rem !important; line-height: 1.3 !important; font-weight: 700 !important; }
.glass-theme h4,
.glass-theme .h4 { font-size: 1.13rem !important; line-height: 1.35 !important; font-weight: 700 !important; }
.glass-theme h5,
.glass-theme .h5 { font-size: 1rem !important; line-height: 1.4 !important; font-weight: 700 !important; }
.glass-theme h6,
.glass-theme .h6 { font-size: .95rem !important; line-height: 1.4 !important; font-weight: 700 !important; }

/* Bootstrap font utilities should follow normal scale again */
.glass-theme .display-1 { font-size: 3.5rem !important; }
.glass-theme .display-2 { font-size: 3rem !important; }
.glass-theme .display-3 { font-size: 2.5rem !important; }
.glass-theme .display-4 { font-size: 2rem !important; }
.glass-theme .display-5 { font-size: 1.75rem !important; }
.glass-theme .display-6 { font-size: 1.5rem !important; }
.glass-theme .fs-1 { font-size: 2.5rem !important; }
.glass-theme .fs-2 { font-size: 2rem !important; }
.glass-theme .fs-3 { font-size: 1.75rem !important; }
.glass-theme .fs-4 { font-size: 1.5rem !important; }
.glass-theme .fs-5 { font-size: 1.25rem !important; }
.glass-theme .fs-6 { font-size: 1rem !important; }

/* Navbar + sidebar */
.glass-theme .navbar-brand,
.glass-theme .brand-text {
    font-size: 1rem !important;
    font-weight: 700 !important;
}

.glass-theme .topnav .small,
.glass-theme .topnav .badge {
    font-size: var(--tm-text-small) !important;
}

.glass-theme .sidenav-light .sidenav-menu .nav-link {
    font-size: .95rem !important;
    line-height: 1.35 !important;
    font-weight: 500 !important;
}

.glass-theme .sidenav-menu-heading {
    font-size: .75rem !important;
    line-height: 1.25 !important;
    letter-spacing: .075em !important;
    font-weight: 700 !important;
}

.glass-theme .sidenav-footer {
    font-size: .9rem !important;
}

/* Page header */
.glass-theme .page-header-title {
    font-size: clamp(1.65rem, 1.25rem + 1vw, 2rem) !important;
    line-height: 1.18 !important;
    font-weight: 700 !important;
    letter-spacing: -.02em !important;
}

.glass-theme .page-header-subtitle {
    font-size: 1rem !important;
    line-height: 1.42 !important;
}

.glass-theme .page-header .badge.bg-white {
    font-size: .875rem !important;
    font-weight: 600 !important;
}

/* Cards */
.glass-theme .card-header {
    font-size: 1rem !important;
    line-height: 1.4 !important;
    font-weight: 700 !important;
}

.glass-theme .card-title {
    font-size: 1.05rem !important;
    line-height: 1.35 !important;
    font-weight: 700 !important;
}

/* KPI cards */
.glass-theme .totel-kpi-label {
    font-size: .78rem !important;
    line-height: 1.25 !important;
    letter-spacing: .05em !important;
    font-weight: 700 !important;
}

.glass-theme .totel-kpi-value {
    font-size: clamp(1.55rem, 1.25rem + .7vw, 2rem) !important;
    line-height: 1.08 !important;
    letter-spacing: -.02em !important;
    font-weight: 750 !important;
}

.glass-theme .totel-kpi-card .small,
.glass-theme .totel-kpi-card small,
.glass-theme .totel-kpi-card .text-muted {
    font-size: .875rem !important;
}

.glass-theme .card.border-start-lg .h3,
.glass-theme .card.border-start-lg h3,
.glass-theme .card .h3.mb-0,
.glass-theme .card .h3.mb-1 {
    font-size: clamp(1.45rem, 1.15rem + .55vw, 1.8rem) !important;
    line-height: 1.12 !important;
    font-weight: 750 !important;
}

/* Forms: 16px input prevents mobile zoom and keeps desktop readable */
.glass-theme .form-label,
.glass-theme label {
    font-size: .95rem !important;
    line-height: 1.35 !important;
    font-weight: 650 !important;
}

.glass-theme .form-control,
.glass-theme .form-select,
.glass-theme input,
.glass-theme select,
.glass-theme textarea {
    font-size: 1rem !important;
    line-height: 1.45 !important;
}

.glass-theme .form-control,
.glass-theme .form-select {
    min-height: 2.6rem;
    padding: .55rem .78rem !important;
}

.glass-theme .form-control-lg,
.glass-theme .form-select-lg {
    min-height: 3rem;
    font-size: 1.05rem !important;
    padding: .68rem .95rem !important;
}

/* Buttons */
.glass-theme .btn {
    font-size: .95rem !important;
    line-height: 1.35 !important;
    font-weight: 650 !important;
    padding: .55rem .9rem !important;
}

.glass-theme .btn-sm {
    font-size: .875rem !important;
    padding: .42rem .7rem !important;
}

.glass-theme .btn-lg {
    font-size: 1rem !important;
    padding: .75rem 1.05rem !important;
}

.glass-theme .badge {
    font-size: .8rem !important;
    line-height: 1.2 !important;
    font-weight: 650 !important;
}

/* Tables: keep report data readable */
.glass-theme .table {
    font-size: .93rem !important;
    line-height: 1.4 !important;
}

.glass-theme .table thead th {
    font-size: .8rem !important;
    line-height: 1.3 !important;
    letter-spacing: .045em !important;
    font-weight: 750 !important;
}

.glass-theme .table td,
.glass-theme .table th {
    font-size: .93rem !important;
    line-height: 1.42 !important;
    padding: .72rem .8rem !important;
}

/* Dashboard-specific sections from mobile cleanup */
.glass-theme .dashboard-filter-card label,
.glass-theme .dashboard-filter-card .form-label {
    font-size: .92rem !important;
}

.glass-theme .quick-action-grid .quick-action-item,
.glass-theme .quick-action-card .list-group-item {
    font-size: .95rem !important;
    line-height: 1.35 !important;
}

.glass-theme .master-flow-card,
.glass-theme .master-flow-card .timeline-item-content,
.glass-theme .timeline,
.glass-theme .timeline .timeline-item-content {
    font-size: .95rem !important;
    line-height: 1.48 !important;
}

.glass-theme .timeline .timeline-item-marker-text {
    font-size: .85rem !important;
    font-weight: 700 !important;
}

/* Login */
body.login-bg.glass-theme .login-card h3 {
    font-size: 1.25rem !important;
    line-height: 1.25 !important;
    font-weight: 750 !important;
}

body.login-bg.glass-theme .login-card .card-header .small,
body.login-bg.glass-theme .login-card .small.opacity-75 {
    font-size: .9rem !important;
}

body.login-bg.glass-theme .login-card label,
body.login-bg.glass-theme .login-card .form-label {
    font-size: .95rem !important;
}

body.login-bg.glass-theme .login-card .form-control {
    font-size: 1rem !important;
}

body.login-bg.glass-theme .login-meta-card {
    font-size: .9rem !important;
    line-height: 1.45 !important;
}

body.login-bg.glass-theme .auth-eyebrow {
    font-size: .9rem !important;
}

body.login-bg.glass-theme .auth-title {
    font-size: clamp(2.25rem, 4vw, 3.75rem) !important;
    line-height: 1.04 !important;
}

body.login-bg.glass-theme .auth-subtitle {
    font-size: 1.05rem !important;
    line-height: 1.5 !important;
}

body.login-bg.glass-theme .auth-feature strong {
    font-size: 1rem !important;
}

/* Mobile final typography balance */
@media (max-width: 991.98px) {
    html { font-size: 16px !important; }

    body,
    body.glass-theme,
    body.login-bg.glass-theme {
        font-size: 1rem !important;
        line-height: 1.5 !important;
    }

    .glass-theme .page-header-title {
        font-size: 1.55rem !important;
    }

    .glass-theme .page-header-subtitle {
        font-size: .96rem !important;
    }

    .glass-theme .card-header {
        font-size: 1rem !important;
    }

    .glass-theme .card,
    .glass-theme .card-body,
    .glass-theme p,
    .glass-theme li,
    .glass-theme .list-group-item,
    .glass-theme .text-muted {
        font-size: .96rem !important;
    }

    .glass-theme .table,
    .glass-theme .table td,
    .glass-theme .table th {
        font-size: .9rem !important;
    }

    .glass-theme .table thead th {
        font-size: .78rem !important;
    }

    .glass-theme .totel-kpi-label {
        font-size: .76rem !important;
    }

    .glass-theme .totel-kpi-value,
    .glass-theme .card.border-start-lg .h3,
    .glass-theme .card .h3.mb-0,
    .glass-theme .card .h3.mb-1 {
        font-size: 1.55rem !important;
    }

    .glass-theme .form-control,
    .glass-theme .form-select,
    .glass-theme input,
    .glass-theme select,
    .glass-theme textarea {
        font-size: 1rem !important;
    }

    .glass-theme .btn {
        font-size: .95rem !important;
    }
}

@media (max-width: 575.98px) {
    html { font-size: 16px !important; }

    .glass-theme .container-xl,
    .container-xl {
        padding-left: .9rem !important;
        padding-right: .9rem !important;
    }

    .glass-theme .page-header-title {
        font-size: 1.42rem !important;
        line-height: 1.2 !important;
    }

    .glass-theme .page-header-subtitle {
        font-size: .94rem !important;
    }

    .glass-theme .card-header {
        font-size: .98rem !important;
    }

    .glass-theme .small,
    .glass-theme small,
    .glass-theme .form-text {
        font-size: .875rem !important;
    }

    .glass-theme .totel-kpi-label {
        font-size: .75rem !important;
    }

    .glass-theme .totel-kpi-value,
    .glass-theme .card.border-start-lg .h3,
    .glass-theme .card .h3.mb-0,
    .glass-theme .card .h3.mb-1 {
        font-size: 1.45rem !important;
    }

    .glass-theme .btn {
        font-size: .95rem !important;
        min-height: 2.55rem;
    }

    .glass-theme .btn-sm {
        font-size: .875rem !important;
        min-height: 2.25rem;
    }

    .glass-theme .form-label,
    .glass-theme label {
        font-size: .93rem !important;
    }

    .glass-theme .form-control,
    .glass-theme .form-select {
        min-height: 2.8rem;
    }

    body.login-bg.glass-theme .login-card h3 {
        font-size: 1.18rem !important;
    }

    body.login-bg.glass-theme .login-card .card-header .small,
    body.login-bg.glass-theme .login-meta-card {
        font-size: .9rem !important;
    }
}
