/**
 * medConnect — Global typography system
 * One font family + one readable scale for every role and surface.
 * Load after design-system.css when available. Typography only — no layout/color redesign.
 */

:root {
  --mc-font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mc-fs-display: 1.375rem;
  --mc-fs-h1: 1.375rem;
  --mc-fs-h2: 1.125rem;
  --mc-fs-h3: 1rem;
  --mc-fs-body: 0.875rem;
  --mc-fs-sm: 0.8125rem;
  --mc-fs-xs: 0.75rem;
  --mc-fs-stat: 1.5rem;
  --mc-fs-nav: 0.8125rem;
  --mc-lh-tight: 1.25;
  --mc-lh-body: 1.45;
}

/* ── Shared font family (all roles + auth surfaces) ── */
html,
body,
body.admin-body,
body.superadmin-body,
body.provider-body,
body.bhw-body,
body.patient-portal,
body.landing-page,
body.login-page,
body.reg-body {
  font-family: var(--mc-font, 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif);
}

button,
input,
select,
textarea,
.mc-btn,
.h-btn,
.pd-btn,
.adm-btn,
.btn-signin {
  font-family: inherit;
}

/* Utility headings stay on the design-system tokens */
.text-h1 {
  font-size: var(--mc-fs-h1);
  line-height: var(--mc-lh-tight, 1.25);
}
.text-h2 {
  font-size: var(--mc-fs-h2);
  line-height: var(--mc-lh-tight, 1.25);
}
.text-h3 {
  font-size: var(--mc-fs-h3);
  line-height: var(--mc-lh-tight, 1.25);
}

/* ── Topbar / page headers (all portals) ── */
.topbar-title,
.pd-header-page {
  font-size: var(--mc-fs-h3);
  font-weight: 700;
  line-height: var(--mc-lh-tight, 1.25);
}

.topbar-eyebrow,
.pd-header-date {
  font-size: var(--mc-fs-xs);
  line-height: 1.3;
}

/* ── Shared sidebar / aqua nav ── */
.sidebar .nav-link,
.sb-aqua .nav-item,
.sb-aqua a,
.adm-sidebar .nav-link {
  font-size: var(--mc-fs-nav);
}

/* ── Admin + SuperAdmin dashboard ── */
body.admin-body .adm-logo-text,
body.superadmin-body .adm-logo-text {
  font-size: 1.125rem;
  line-height: 1;
}

body.admin-body .adm-logo-text em,
body.superadmin-body .adm-logo-text em {
  display: none;
}

body.admin-body .adm-nav-item,
body.superadmin-body .adm-nav-item {
  font-size: var(--mc-fs-nav);
  line-height: 1.3;
  padding: 8px 12px;
  gap: 9px;
}

body.admin-body .adm-nav,
body.superadmin-body .adm-nav {
  padding: 12px 10px 8px;
  gap: 1px;
}

/* Keep standalone footer (My Profile / Settings) on the same horizontal grid */
body.admin-body .adm-nav-footer,
body.superadmin-body .adm-nav-footer {
  padding-left: 10px;
  padding-right: 10px;
}

body.admin-body .adm-nav-section,
body.superadmin-body .adm-nav-section {
  font-size: var(--mc-fs-xs);
  letter-spacing: 0.06em;
  line-height: 1.3;
  margin: 10px 8px 4px;
}

body.admin-body .topbar-title,
body.superadmin-body .topbar-title {
  font-size: var(--mc-fs-h3);
}

body.admin-body .adm-banner-title,
body.superadmin-body .adm-banner-title {
  font-size: var(--mc-fs-display);
  line-height: var(--mc-lh-tight, 1.25);
}

body.admin-body .adm-banner-sub,
body.superadmin-body .adm-banner-sub {
  font-size: var(--mc-fs-sm);
  line-height: 1.45;
}

body.admin-body .adm-banner-eyebrow,
body.superadmin-body .adm-banner-eyebrow {
  font-size: var(--mc-fs-xs);
}

body.admin-body .adm-section-title,
body.superadmin-body .adm-section-title {
  font-size: var(--mc-fs-h3);
  font-weight: 700;
  line-height: var(--mc-lh-tight, 1.25);
}

body.admin-body .adm-section-sub,
body.superadmin-body .adm-section-sub {
  font-size: var(--mc-fs-sm);
  line-height: 1.45;
}

body.admin-body .adm-metric-value,
body.superadmin-body .adm-metric-value {
  font-size: var(--mc-fs-stat);
  line-height: 1.1;
}

body.admin-body .adm-metric-label,
body.superadmin-body .adm-metric-label {
  font-size: var(--mc-fs-sm);
}

body.admin-body .adm-metric-sub,
body.superadmin-body .adm-metric-sub {
  font-size: var(--mc-fs-xs);
}

body.admin-body .adm-card-head-title,
body.superadmin-body .adm-card-head-title {
  font-size: var(--mc-fs-h3);
}

body.admin-body .adm-card-head-sub,
body.superadmin-body .adm-card-head-sub {
  font-size: var(--mc-fs-xs);
}

body.admin-body .adm-table,
body.superadmin-body .adm-table,
body.admin-body .mc-table,
body.superadmin-body .mc-table {
  font-size: var(--mc-fs-body);
}

body.admin-body .adm-table th,
body.superadmin-body .adm-table th {
  font-size: var(--mc-fs-xs);
}

body.admin-body .mc-notif-widget-value,
body.superadmin-body .mc-notif-widget-value {
  font-size: var(--mc-fs-stat);
  line-height: 1.15;
}

body.admin-body .mc-notif-widget-label,
body.superadmin-body .mc-notif-widget-label {
  font-size: var(--mc-fs-sm);
}

/* Chart cards — shared scale (overrides any residual oversized clamps) */
.mc-chart-card__title,
.adm-chart-card__title,
.bhw-chart-card h4,
.bhw-chart-card h3 {
  font-size: var(--mc-fs-h3);
  font-weight: 700;
  line-height: 1.3;
}

.mc-chart-card__sub,
.adm-chart-card__sub {
  font-size: var(--mc-fs-sm);
  line-height: 1.4;
}

.mc-chart-kpi strong,
.adm-chart-kpi strong {
  font-size: var(--mc-fs-stat);
  line-height: 1.15;
}

.mc-chart-kpi span,
.adm-chart-kpi span {
  font-size: var(--mc-fs-xs);
}

/* ── Provider ── */
body.provider-body .pd-header-page {
  font-size: var(--mc-fs-h3);
}

body.provider-body .prov-dash-welcome__title,
body.provider-body .text-h1,
body.provider-body .text-h2 {
  font-size: var(--mc-fs-h1);
  line-height: var(--mc-lh-tight, 1.25);
}

body.provider-body .text-h2 {
  font-size: var(--mc-fs-h2);
}

body.provider-body .text-h3 {
  font-size: var(--mc-fs-h3);
}

/* ── BHW ── */
body.bhw-body .text-h1,
body.bhw-body .text-h2,
body.bhw-body .bhw-update-header .text-h2,
body.bhw-body .bhw-page-title {
  font-size: var(--mc-fs-h2);
  line-height: var(--mc-lh-tight, 1.25);
}

body.bhw-body .text-h1 {
  font-size: var(--mc-fs-h1);
}

body.bhw-body .adm-nav-item,
body.bhw-body .bhw-sidebar .adm-nav-item {
  font-size: var(--mc-fs-nav);
  line-height: 1.3;
}

/* Soften oversized BHW clamp titles without fighting layout */
body.bhw-body .bhw-dash .adm-banner-title,
body.bhw-body .bhw-welcome-title,
body.bhw-body .bhw-reports-page h2,
body.bhw-body .bhw-consultations-page .text-h2 {
  font-size: var(--mc-fs-display);
  line-height: var(--mc-lh-tight, 1.25);
}

/* ── Patient ── */
body.patient-portal .text-h1,
body.patient-portal .placeholder-title,
body.patient-portal .section-title {
  font-size: var(--mc-fs-h1);
  line-height: var(--mc-lh-tight, 1.25);
}

body.patient-portal .text-h2,
body.patient-portal .pi-card-title,
body.patient-portal .rd-title,
body.patient-portal .consult-list-title {
  font-size: var(--mc-fs-h2);
  line-height: var(--mc-lh-tight, 1.25);
}

body.patient-portal .text-h3 {
  font-size: var(--mc-fs-h3);
}

body.patient-portal .adm-banner-title,
body.patient-portal .patient-dash-banner .adm-banner-title {
  font-size: var(--mc-fs-display);
  line-height: var(--mc-lh-tight, 1.25);
}

/* ── Forms / buttons / alerts (shared) ── */
label,
.form-group label,
.mc-label {
  font-size: var(--mc-fs-sm);
}

.mc-btn,
.h-btn,
.pd-btn,
.adm-btn,
.session-btn,
.btn-primary,
.btn-secondary {
  font-size: var(--mc-fs-sm);
}

.alert,
.mc-alert,
.signin-context-alert {
  font-size: var(--mc-fs-sm);
  line-height: 1.45;
}

/* ── Sign In / Landing ── */
body.landing-page,
body.login-page {
  font-size: var(--mc-fs-body);
}

.landing-page .hero-signin-panel .card-title,
body.login-page .card-title {
  font-size: var(--mc-fs-h2);
  line-height: var(--mc-lh-tight, 1.25);
}

.landing-page .hero-signin-panel .card-sub,
body.login-page .card-sub {
  font-size: var(--mc-fs-sm);
  line-height: 1.45;
}

.landing-page .hero-signin-panel .form-group label,
body.login-page .form-group label {
  font-size: var(--mc-fs-sm);
}

.landing-page .hero-signin-panel .btn-signin,
body.login-page .btn-signin {
  font-size: var(--mc-fs-body);
}

/* ── Responsive scale ── */
@media (max-width: 768px) {
  :root {
    --mc-fs-display: 1.25rem;
    --mc-fs-h1: 1.25rem;
    --mc-fs-h2: 1.0625rem;
    --mc-fs-h3: 0.9375rem;
    --mc-fs-stat: 1.35rem;
  }

  body.admin-body .adm-banner-title,
  body.superadmin-body .adm-banner-title,
  body.patient-portal .adm-banner-title {
    font-size: var(--mc-fs-display);
  }

  body.admin-body .adm-metric-value,
  body.superadmin-body .adm-metric-value,
  body.admin-body .mc-notif-widget-value,
  body.superadmin-body .mc-notif-widget-value {
    font-size: var(--mc-fs-stat);
  }

  .topbar-title,
  .pd-header-page {
    font-size: 0.9375rem;
  }
}

@media (max-width: 430px) {
  :root {
    --mc-fs-display: 1.175rem;
    --mc-fs-h1: 1.175rem;
    --mc-fs-h2: 1rem;
    --mc-fs-stat: 1.25rem;
  }

  body.admin-body .adm-nav-item,
  body.superadmin-body .adm-nav-item {
    font-size: 0.78rem;
    padding: 7px 10px;
  }

  .landing-page .hero-signin-panel .card-title,
  body.login-page .card-title {
    font-size: 1.05rem;
  }
}

@media (max-width: 360px) {
  :root {
    --mc-fs-display: 1.1rem;
    --mc-fs-h1: 1.1rem;
    --mc-fs-stat: 1.2rem;
  }
}
