/* Authenticated administration typography. Keep rem-based layout dimensions intact.
   Loaded after scoped styles: important rules bridge the older per-page scales. */
.portal-shell {
    font-family: var(--entria-font-family);
    font-size: var(--entria-text-base);
    font-weight: var(--entria-weight-400);
    line-height: 1.43;
    letter-spacing: .2px;
}

@scope (.portal-shell) to ([contenteditable="true"], .worker-template-preview,
    .worker-template-paper-preview, .signature-preview, pre, code, .leaflet-container) {

/* Form controls and actions share the readable body size, regardless of page. */
:scope :where(button, input, select, textarea, .school-secondary-link-button,
    .school-primary-button, .school-secondary-button, .school-filter-button) {
    font-family: var(--entria-font-family) !important;
    font-size: var(--entria-text-base) !important;
    font-weight: var(--entria-weight-500) !important;
    line-height: 1.43 !important;
    letter-spacing: .2px !important;
}
:scope :where(button, .school-primary-button, .school-secondary-button,
    .school-secondary-link-button) > :where(span:not([aria-hidden="true"]), strong) {
    font-family: inherit !important;
    font-size: inherit !important;
    font-weight: inherit !important;
}
:scope :where(input, select, textarea) { font-weight: var(--entria-weight-400) !important; }

/* Heading levels, including the legacy canonical-title rule. */
:scope :where(h1, .dashboard-title) {
    font-family: var(--entria-font-family) !important;
    font-size: var(--entria-text-title) !important;
    font-weight: var(--entria-weight-600) !important;
    line-height: 1.2 !important;
    letter-spacing: 0 !important;
}
:scope :where(h2, h3, h4, h5, h6, .school-section-title) {
    font-size: var(--entria-text-section) !important;
    font-weight: var(--entria-weight-500) !important;
    line-height: 1.5 !important;
    letter-spacing: .15px !important;
}
:scope .app-modal-title :where(h2, h3) {
    font-size: var(--entria-text-modal) !important;
    font-weight: var(--entria-weight-600) !important;
    line-height: 1.3 !important;
}
:scope :where(strong, b, th, .school-person-title) { font-weight: var(--entria-weight-600) !important; }

/* Standard copy and tabular data. Descendant text inherits so table identity,
   description and date columns do not keep their previous miniature scale. */
:scope :where(.portal-content p, .portal-content li, .portal-content dt,
    .portal-content dd, .portal-content td, .school-person-title,
    .notification-card-copy > span, .review-action-summary,
    .review-worksheet-tools, .review-quick-context, .review-quick-footer > span,
    .review-bulk, .review-action-summary > strong) {
    font-size: var(--entria-text-base) !important;
    line-height: 1.43 !important;
}
:scope :where(td, .school-person-copy, .review-employee, .notification-title-row)
    :where(strong, .school-person-title) {
    font-size: var(--entria-text-base) !important;
    line-height: 1.43 !important;
}
:scope :where(td, .school-person-copy) > span:not([class]) {
    font-size: inherit !important;
}
:scope :where(th, .school-labeled-field, .school-labeled-field > span,
    .app-form-label, .school-page-size-selector, .school-table-footer,
    .school-results-count, .school-pagination-summary, .school-filter-summary,
    .school-metric-label, .notification-status, .school-status-badge,
    .school-tag, .review-day-label, .review-shortcuts) {
    font-size: var(--entria-text-sm) !important;
    line-height: 1.43 !important;
    font-weight: var(--entria-weight-500) !important;
}
:scope :where(small, .school-person-subtitle, .school-metric-subvalue,
    .school-field-help, .school-form-help, .school-helper-text,
    .review-original, .review-policy-note, .review-legend, .review-record-index,
    .review-quick-help, .review-quick-enter, .review-drafts, .review-zero) {
    font-size: var(--entria-text-xs) !important;
    line-height: 1.5 !important;
    font-weight: var(--entria-weight-400) !important;
}
:scope :where(.school-labeled-field > small, .school-person-copy > span,
    .review-employee small) {
    font-size: var(--entria-text-xs) !important;
    font-weight: var(--entria-weight-400) !important;
}
:scope :where(.dashboard-header, .school-page-header, .company-executive-header,
    .wellbeing-hero, .assessment-header, .results-header, .action-plan-header,
    .comms-header, .cases-page-header, .gov-header, .dossier-header) p {
    font-size: var(--entria-text-base) !important;
    font-weight: var(--entria-weight-400) !important;
}
:scope :where(.school-metric-value, .dashboard-kpi-value, .kpi-value) {
    font-size: var(--entria-text-display) !important;
    font-weight: var(--entria-weight-500) !important;
    line-height: 1.15 !important;
    letter-spacing: 0 !important;
    font-variant-numeric: tabular-nums;
}

/* Navigation and view switching use weight, rather than a different text size. */
:scope :where(.portal-nav-link, .portal-nav-link span, .portal-nav-link p,
    .portal-context-name, .portal-user-menu, .portal-context-option,
    .portal-help-button, .portal-nav-submenu a) {
    font-size: var(--entria-text-base) !important;
    font-weight: var(--entria-weight-400) !important;
    line-height: 1.43 !important;
}
:scope .portal-nav :where(a, summary) {
    font-size: var(--entria-text-base) !important;
    font-weight: var(--entria-weight-400) !important;
    line-height: 1.43 !important;
}
:scope .portal-nav :where(a, summary) > span {
    font-size: inherit !important;
    font-weight: inherit !important;
}
:scope .portal-nav a.active { font-weight: var(--entria-weight-600) !important; }
:scope :where(.dashboard-panel-link, .work-task-action,
    .work-quick-action strong, .work-task-copy strong, .work-timeline-item strong,
    .work-alert-card li, .work-alert-card li strong, .work-task-head,
    .employee-directory-result-count, .employee-selection-summary,
    .incident-selection-toolbar, .review-summary) {
    font-size: var(--entria-text-base) !important;
    line-height: 1.43 !important;
}
:scope :where(.work-task-action, .dashboard-panel-link) { font-weight: var(--entria-weight-500) !important; }
:scope :where(.work-timeline-time, .work-task-copy small,
    .work-priority, .work-today-card span, .work-alert-caption,
    .work-task-due, .school-person-copy > small) {
    font-size: var(--entria-text-xs) !important;
    line-height: 1.5 !important;
    font-weight: var(--entria-weight-400) !important;
}
:scope .work-today-card strong {
    font-size: var(--entria-text-display) !important;
    font-weight: var(--entria-weight-500) !important;
}
/* Secondary text in operational cards and older catalog tables. */
:scope :where(label, label > span, .employee-results-count,
    .vacation-table-heading > span, .shift-bulk-actions > span,
    .company-kpi-copy > span, .company-report-more-filters summary,
    .company-report-tabs-range, .company-report-tabs-range > span,
    .settings-breadcrumb, .settings-breadcrumb > span, .settings-breadcrumb > a,
    .worker-operations-pagination > span, .worker-operations-check > span) {
    font-size: var(--entria-text-sm) !important;
    line-height: 1.43 !important;
    font-weight: var(--entria-weight-500) !important;
}
:scope :where(.employee-table-scroll-tools > span,
    .employee-directory-cell-stack > span, .employee-access-pill,
    .employee-configuration-pill, .school-status-pill,
    .company-inline-pill, .company-vacation-premium-status,
    .work-schedule-meal-badge, .work-schedule-hours-cell > span,
    .attendance-donut-center > span, .company-daily-column > span,
    .biometric-event-report-closed, .worker-documents-modal > header > span) {
    font-size: var(--entria-text-xs) !important;
    line-height: 1.5 !important;
    font-weight: var(--entria-weight-400) !important;
}
:scope :where(.work-alert-text, .work-alert-action, .school-info-copy,
    .school-info-copy > div, .school-info-copy > strong, .school-secondary-link,
    .worker-documents-empty, .school-banner, .review-excel-file,
    .review-excel-file > span, .company-report-tabs-range > strong,
    .company-daily-column > strong, .tenant-logo-actions > strong) {
    font-size: var(--entria-text-base) !important;
    line-height: 1.43 !important;
    font-weight: var(--entria-weight-400) !important;
}
:scope .work-alert-action { font-weight: var(--entria-weight-500) !important; }
:scope .work-alert-body > strong {
    font-size: var(--entria-text-sm) !important;
    font-weight: var(--entria-weight-500) !important;
}
:scope :where(.work-filter-button, .work-filter-button > span) {
    font-size: var(--entria-text-base) !important;
    font-weight: var(--entria-weight-500) !important;
}
:scope :where(.work-alert-chip, .work-alert-header p, .work-greeting-metrics span) {
    font-size: var(--entria-text-xs) !important;
    font-weight: var(--entria-weight-500) !important;
    line-height: 1.5 !important;
}
:scope :where(.attendance-legend-row, .school-bar-row, .company-bar-item,
    .company-critical-row) :where(span, strong) {
    font-size: var(--entria-text-sm) !important;
    line-height: 1.43 !important;
}
:scope .school-subpanel-header > strong {
    font-size: var(--entria-text-section) !important;
    font-weight: var(--entria-weight-500) !important;
}
:scope :where(.company-kpi-copy > strong, .work-alert-count) {
    font-size: var(--entria-text-display) !important;
    font-weight: var(--entria-weight-500) !important;
    line-height: 1.15 !important;
}
:scope .work-tabs button.active { font-weight: var(--entria-weight-600) !important; }
:scope .review-excel-file { font-weight: var(--entria-weight-500) !important; }
:scope :where(.incident-review-modes button, .school-tab-button,
    .school-tab, .settings-tab, .worker-document-tab) { font-weight: var(--entria-weight-400) !important; }
:scope :where([aria-current="page"], [role="tab"][aria-selected="true"],
    .incident-review-modes button[aria-current="page"], .school-tab-button.active,
    .school-tab.active, .settings-tab.active) { font-weight: var(--entria-weight-600) !important; }
:scope :where(.school-avatar, .review-avatar) {
    font-size: var(--entria-text-sm) !important;
    font-weight: var(--entria-weight-600) !important;
}
:scope :where(.review-matrix td, .review-cell-value,
    .review-daily-total, .review-employee-total, .review-matrix input) {
    font-variant-numeric: tabular-nums;
}

@media (max-width: 650px) {
    :scope { --entria-text-title: var(--entria-text-title-mobile); }
    /* Let readable auxiliary copy use its own line in narrow metric cards. */
    :scope .school-metric-copy { grid-template-columns: minmax(0, 1fr) !important; }
    :scope :where(.school-metric-label, .school-metric-value, .school-metric-subvalue) {
        grid-column: 1 / -1 !important;
        overflow-wrap: normal !important;
        word-break: normal !important;
    }
}

/* No rules for rich-text document canvases, signature faces, code, SVG, the
   public site or native mobile app. Those keep their own typography contracts. */
}

/* Web application roots share the interface family; documents keep their own faces. */
:is(.platform-shell, .worker-portal-screen, .login-shell) { font-family: var(--entria-font-family); font-size: var(--entria-text-base); }
