/*
   Application-wide type system.
   This file intentionally loads last so feature styles can control layout and
   colour without introducing a different font or an unrelated type scale.
*/
:root {
    --font-ui: Arial, Helvetica, sans-serif;
    --font-mono: Consolas, "Courier New", monospace;
    --type-caption: .6875rem; /* 11px */
    --type-small: .75rem;    /* 12px */
    --type-body: .8125rem;   /* 13px */
    --type-label: .75rem;    /* 12px */
    --type-h4: .875rem;      /* 14px */
    --type-h3: 1rem;         /* 16px */
    --type-h2: 1.375rem;     /* 22px */
    --type-h1: 1.5rem;       /* 24px */
    --type-metric: 1.5rem;   /* 24px */
}

html,
body {
    font-family: var(--font-ui);
    font-size: 16px;
}

body {
    font-size: var(--type-body);
    line-height: 1.45;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

/* Remove feature-level condensed-font fallbacks from the rendered interface. */
body *:not(code):not(pre):not(kbd):not(.mono):not(.signature):not(.fake-qr) {
    font-family: var(--font-ui) !important;
}

code,
pre,
kbd,
.mono {
    font-family: var(--font-mono) !important;
}

h1,
h2,
h3,
h4,
p {
    overflow-wrap: anywhere;
}

h1,
.quality-shell .topbar h1,
.topbar h1 {
    font-size: var(--type-h1) !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
}

h2,
.hero h2,
.admin-hero h2,
.global-hero h2,
.global-admin-hero h2,
.global-page-heading h2,
.work-hero h2,
.full-heading h2,
.panel h2 {
    font-size: var(--type-h2) !important;
    font-weight: 700 !important;
    line-height: 1.22 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
}

h3,
.panel h3,
.panel-heading h3,
.calendar-month-heading h3,
.phase-content h3 {
    font-size: var(--type-h3) !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
}

h4,
.portfolio-card h4,
.calendar-event-name h4 {
    font-size: var(--type-h4) !important;
    font-weight: 700 !important;
    line-height: 1.35 !important;
}

p,
li,
dt,
dd,
.muted {
    line-height: 1.5;
}

small,
.muted,
.table-note,
.panel-heading p,
.global-admin-hero p,
.global-page-heading p,
.portfolio-card p,
.calendar-event-name p {
    font-size: var(--type-caption) !important;
}

.eyebrow,
.nav-section-label,
.hero-kicker,
.section-label {
    font-size: var(--type-caption) !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
    letter-spacing: .04em !important;
    text-transform: uppercase !important;
}

label,
.field-label,
.form-grid label,
.event-toolbar label,
.hero-actions label,
.global-filter-bar label,
.onboarding-grid label,
.governance-form label,
.inline-invite label,
.retention-grid label,
.team-merge-form label,
.inline-manager-edit label {
    font-size: var(--type-label) !important;
    line-height: 1.3 !important;
}

button,
input,
select,
textarea,
.primary,
.secondary,
.ghost,
.copy,
.button,
.text-button,
.row-action {
    font-size: var(--type-small) !important;
    line-height: 1.35 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
}

table th,
th {
    font-size: var(--type-caption) !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    letter-spacing: .035em !important;
}

table td,
td {
    font-size: var(--type-small) !important;
    line-height: 1.4 !important;
}

td small,
th small {
    font-size: var(--type-caption) !important;
}

.pill,
.badge,
.workspace-badge,
.country-code,
.evidence-label {
    font-size: var(--type-caption) !important;
    line-height: 1.2 !important;
    letter-spacing: 0 !important;
}

/* One consistent metric treatment across regional, global and technical views. */
.kpis strong,
.metric-card strong,
.global-stat-grid strong,
.calendar-kpis strong,
.audit-summary strong,
.outlook-summary strong,
.dashboard-funnel strong,
.team-stats strong,
.event-mini-kpis strong,
.directory-count strong,
.event-demand b,
.calendar-numbers b,
.status-board strong,
.work-summary strong,
.inbox-stat strong,
.points,
.place,
.car-no {
    font-size: var(--type-metric) !important;
    font-weight: 700 !important;
    line-height: 1.1 !important;
    letter-spacing: 0 !important;
}

.hero-stat strong {
    font-size: 2rem !important;
    line-height: 1.1 !important;
}

.hero-stat strong small,
.weight small {
    font-size: .875rem !important;
}

.weight strong,
.phase-number {
    font-size: 2rem !important;
    line-height: 1.1 !important;
}

.brand,
.brand strong,
.season-card strong,
.quality-shell .nav-item,
.quality-shell .nav-link,
.nav-item {
    letter-spacing: 0 !important;
    text-transform: none !important;
}

/* Keep the global planning calendar readable on wide desktop dashboards. */
.calendar-month-heading span,
.calendar-month-heading > b,
.global-calendar-event > time span,
.calendar-numbers span,
.calendar-models span,
.model-demand > div {
    font-size: var(--type-caption) !important;
    line-height: 1.35 !important;
}

.calendar-event-name p,
.calendar-confidence small,
.definition-list dt,
.definition-list dd {
    font-size: var(--type-small) !important;
    line-height: 1.45 !important;
}

@media (max-width: 760px) {
    :root {
        --type-h1: 1.375rem;
        --type-h2: 1.25rem;
        --type-metric: 1.375rem;
    }
}

/* Account for the persistent application rail when dense page toolbars are shown. */
@media (max-width: 1400px) {
    .team-directory-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .team-directory-controls {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        margin: 10px 0 0;
    }
}
