/* Global SaaS typography normalization — loaded after all module overrides. */
html,
body,
.vesta-app-shell,
.vesta-app-body,
.vesta-page-shell,
.vesta-ad-shell,
.vesta-ad-page,
.vesta-sidebar,
.vesta-topbar,
.vesta-admin-tab-panel {
  font-family: var(--vesta-font) !important;
  font-size: var(--vesta-fs-body) !important;
  line-height: var(--vesta-lh-body) !important;
  font-weight: var(--vesta-fw-body) !important;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.vesta-ad-shell *,
.vesta-page-shell *,
.vesta-admin-tab-panel *,
.vesta-ad-shell *::before,
.vesta-ad-shell *::after,
.vesta-page-shell *::before,
.vesta-page-shell *::after {
  font-family: inherit !important;
}

/* Page-level headings */
.vesta-page-header h1,
.vesta-page-title,
.vesta-dashboard-title,
.ap-dashboard-hero h1,
.ap-page-head h1,
.ap-auth-copy h1,
.ap-login-hero h1,
.ap-register-hero h1,
.vesta-auth-card h1,
.vesta-auth-panel h1,
.vesta-ad-shell h1 {
  font-size: var(--vesta-fs-page-title) !important;
  line-height: var(--vesta-lh-title) !important;
  letter-spacing: var(--vesta-ls-title) !important;
  font-weight: var(--vesta-fw-title) !important;
}

/* Section headings */
.vesta-ad-shell h2,
.vesta-card__title,
.vesta-section-title,
.ap-panel h2,
.ap-panel-head h2,
.ap-section-title,
.ap-command-title,
.ap-preview-title,
.ap-card-title {
  font-size: var(--vesta-fs-section-title) !important;
  line-height: var(--vesta-lh-title) !important;
  letter-spacing: var(--vesta-ls-title) !important;
  font-weight: var(--vesta-fw-title) !important;
}

/* Drawer/modal headings */
.ap-drawer h2,
.ap-drawer.is-open h2,
.vesta-drawer h2,
.vesta-modal h2,
.ap-modal h2,
.ap-creative-drawer h2,
.ap-placement-drawer h2,
.ap-order-drawer h2,
.ap-message-drawer h2 {
  font-size: var(--vesta-fs-drawer-title) !important;
  line-height: var(--vesta-lh-title) !important;
  letter-spacing: var(--vesta-ls-title) !important;
  font-weight: var(--vesta-fw-title) !important;
}

/* Card titles and compact module headings */
.ap-module-card strong,
.ap-card strong,
.ap-card h3,
.ap-message-card h3,
.ap-email-card h3,
.ap-order-card h3,
.ap-creative-card h3,
.ap-slot-card h3,
.ap-placement-card h3,
.ap-renewal-card h3,
.vesta-card h3,
.vesta-card strong {
  font-size: var(--vesta-fs-card-title) !important;
  line-height: 1.25 !important;
  letter-spacing: -0.015em !important;
  font-weight: var(--vesta-fw-title) !important;
}

/* Body and descriptive text */
.vesta-ad-shell p,
.vesta-ad-shell li,
.vesta-ad-shell span,
.vesta-ad-shell div,
.ap-dashboard-hero p,
.ap-page-head p,
.ap-panel-head p,
.ap-module-card p,
.ap-card p,
.ap-drawer p,
.ap-message-card p,
.ap-email-card p,
.ap-order-card p,
.ap-creative-card p,
.ap-slot-card p,
.ap-placement-card p,
.ap-renewal-card p,
.vesta-card p,
.vesta-topbar,
.vesta-sidebar {
  font-size: var(--vesta-fs-body) !important;
  line-height: var(--vesta-lh-body) !important;
  font-weight: var(--vesta-fw-body) !important;
}

/* Small/meta text */
.vesta-ad-shell small,
.vesta-ad-shell .description,
.ap-table small,
.ap-meta,
.ap-muted,
.ap-card-meta,
.ap-activity-list span,
.ap-action-list span,
.ap-pagination,
.ap-stat em,
.ap-kpi-trend,
.vesta-sidebar__meta,
.vesta-topbar__meta {
  font-size: var(--vesta-fs-small) !important;
  line-height: 1.35 !important;
  font-weight: var(--vesta-fw-subtitle) !important;
}

/* Labels */
.vesta-ad-shell label,
.ap-form-stack label,
.ap-form-grid label,
.ap-field-label,
.ap-filter-label,
.vesta-form label {
  font-size: var(--vesta-fs-label) !important;
  line-height: 1.3 !important;
  font-weight: var(--vesta-fw-label) !important;
}

/* Buttons and action chips */
.vesta-ad-shell button,
.vesta-ad-shell .button,
.ap-primary,
.ap-secondary,
.ap-mini-btn,
.ap-filterbar button,
.ap-panel-head button,
.ap-actions-combo button,
.vesta-view-switch__button,
.vesta-button,
.vesta-quick-action {
  font-size: var(--vesta-fs-button) !important;
  line-height: 1.15 !important;
  font-weight: var(--vesta-fw-button) !important;
  letter-spacing: 0 !important;
}

/* Inputs */
.vesta-ad-shell input,
.vesta-ad-shell select,
.vesta-ad-shell textarea,
.vesta-search,
.ap-input,
.vesta-input {
  font-size: var(--vesta-fs-input) !important;
  line-height: 1.25 !important;
  font-weight: var(--vesta-fw-body) !important;
}

/* Tables */
.ap-table,
.ap-mini-table,
.vesta-table,
.vesta-ad-shell table {
  font-size: var(--vesta-fs-table) !important;
  line-height: 1.35 !important;
}
.ap-table th,
.ap-mini-table th,
.vesta-table th,
.vesta-ad-shell table th {
  font-size: calc(var(--vesta-fs-table) - 1px) !important;
  line-height: 1.25 !important;
  font-weight: var(--vesta-fw-label) !important;
  letter-spacing: .01em !important;
}
.ap-table td,
.ap-mini-table td,
.vesta-table td,
.vesta-ad-shell table td,
.ap-table td strong {
  font-size: var(--vesta-fs-table) !important;
  line-height: 1.35 !important;
  font-weight: var(--vesta-fw-body) !important;
}
.ap-table td strong,
.vesta-table td strong { font-weight: var(--vesta-fw-label) !important; }

/* KPI/stat cards — reduce bulky count typography */
.ap-stat strong,
.ap-action-kpis strong,
.ap-orders-kpis strong,
.ap-operational-kpis .ap-stat strong,
.ap-stats-row.mini .ap-stat strong,
.ap-stats-row-analytics .ap-stat strong,
.ap-analytics-card strong,
.ap-kpi-value,
.vesta-kpi-value,
.vesta-stat__value {
  font-size: var(--vesta-fs-kpi) !important;
  line-height: 1.05 !important;
  letter-spacing: -0.025em !important;
  font-weight: var(--vesta-fw-kpi) !important;
}
.ap-stats-row.mini .ap-stat strong,
.ap-compact-kpi strong,
.ap-mini-kpi strong {
  font-size: var(--vesta-fs-kpi-compact) !important;
}
.ap-stat small,
.ap-action-kpis small,
.ap-orders-kpis small,
.ap-operational-kpis .ap-stat small,
.ap-stats-row-analytics .ap-stat small,
.ap-analytics-card small,
.vesta-stat__label {
  font-size: var(--vesta-fs-small) !important;
  line-height: 1.3 !important;
  font-weight: var(--vesta-fw-subtitle) !important;
}

/* Badges should stay compact */
.ap-badge,
.vesta-badge,
.status-badge,
.ap-status-pill {
  font-size: calc(var(--vesta-fs-small) - 1px) !important;
  line-height: 1.1 !important;
  font-weight: var(--vesta-fw-label) !important;
}

@media (max-width: 900px) {
  :root,.vesta-app-shell,.vesta-ad-shell {
    --vesta-fs-page-title: min(22px, var(--vesta-fs-page-title));
    --vesta-fs-section-title: min(17px, var(--vesta-fs-section-title));
    --vesta-fs-kpi: min(21px, var(--vesta-fs-kpi));
  }
}
