/* Shared workspace text hierarchy. Loaded after page styles, on every shell.
   Public marketing and printable documents keep their own type systems. */
:is(body.authenticated, .dtl-v2, .idx-v2, .ord-v2, .frm-v2, .dash-v2, .rep-v2, .nx-v2, .pc-v2, .wm-page-shell) {
  font-family: var(--font-family);
  font-size: var(--wm-type-body);
  --font-size-xxs: var(--wm-type-label);
  --font-size-xs: var(--wm-type-label);
  --font-size-sm: var(--wm-type-body);
}
.wm-type-body { font-size: var(--wm-type-body); }
.wm-type-caption { font-size: var(--wm-type-label); }
/* Legacy utility sizes are aliases, not independent dashboard type scales. */
body.authenticated #main-content :is([class*="text-[10px]"], [class*="text-[11px]"], [class*="text-[12px]"], small) { font-size: var(--wm-type-label); }
body.authenticated #main-content :is([class*="text-[13px]"], [class*="text-[14px]"], [class*="text-[15px]"], [class*="text-[16px]"]) { font-size: var(--wm-type-body); }

:is(body.authenticated #main-content, .dtl-v2, .idx-v2, .ord-v2, .frm-v2, .dash-v2, .rep-v2, .nx-v2, .pc-v2, .wm-page-shell) :where(dd, td, input, select, textarea, button:not([class*="icon"]), summary, .wm-btn, .dtl-btn-sec, .dtl-row-action, .wm-type-body, .text-sm, .text-base, .text-lg, .text-xl) {
  font-size: var(--wm-type-body);
  line-height: var(--wm-leading-text);
}
:is(body.authenticated #main-content, .dtl-v2, .idx-v2, .ord-v2, .frm-v2, .dash-v2, .rep-v2, .nx-v2, .pc-v2, .wm-page-shell) :where(h2, h3, h4, .dtl-card-title, .wm-card-title, .frm-card-title) {
  font-family: var(--font-family);
  font-size: var(--wm-type-section);
  line-height: var(--wm-leading-text);
  font-weight: var(--wm-weight-strong);
  text-transform: none;
  letter-spacing: normal;
}
:is(body.authenticated #main-content, .dtl-v2, .idx-v2, .ord-v2, .frm-v2, .dash-v2, .rep-v2, .nx-v2, .pc-v2, .wm-page-shell) :where(h1, .wm-page-title) {
  font-family: var(--font-family);
  font-size: var(--wm-type-page);
  line-height: var(--wm-leading-title);
  font-weight: var(--wm-weight-strong);
  text-transform: none;
  letter-spacing: normal;
}
:is(body.authenticated #main-content, .dtl-v2, .idx-v2, .ord-v2, .frm-v2, .dash-v2, .rep-v2, .nx-v2, .pc-v2, .wm-page-shell) :where(.wm-type-caption, .text-xs, .wm-field-help, .wm-cell-sub, .dtl-h-sub, .dtl-dd-sub, .dtl-note-body, .frm-kpi-label, .idx-kpi-label, .wm-kpi-label, .order-lifecycle li) {
  font-family: var(--font-family);
  font-size: var(--wm-type-label);
  line-height: var(--wm-leading-text);
  font-weight: var(--wm-weight-regular);
  text-transform: none;
  letter-spacing: normal;
}
:is(body.authenticated #main-content, .dtl-v2, .idx-v2, .ord-v2, .frm-v2, .dash-v2, .rep-v2, .nx-v2, .pc-v2, .wm-page-shell) :where(dt, thead th, label, legend, .dtl-dt, .dtl-label, .frm-label, .frm-line-label, .wm-field-label) {
  font-family: var(--font-family);
  font-size: var(--wm-type-body);
  line-height: var(--wm-leading-text);
  text-transform: none;
  letter-spacing: normal;
  font-weight: var(--wm-weight-medium);
}
/* Authoritative component typography (page styles own geometry and color): a link and a button in the same
   menu are peers. Labels and status use body text; reserve captions for metadata. */
:is(body.authenticated #main-content, .dtl-v2, .idx-v2, .ord-v2, .frm-v2, .dash-v2, .rep-v2, .nx-v2, .pc-v2, .wm-page-shell) :where(.dtl-menu-item, .wm-menu-item, [role="menuitem"]) {
  font-family: var(--font-family);
  font-size: var(--wm-type-body);
  line-height: var(--wm-leading-text);
  font-weight: var(--wm-weight-regular);
  letter-spacing: normal;
  text-transform: none;
}
:is(body.authenticated #main-content, .dtl-v2, .idx-v2, .ord-v2, .frm-v2, .dash-v2, .rep-v2, .nx-v2, .pc-v2, .wm-page-shell) :where(.dtl-status, .dtl-chip, .idx-row-status, .idx-chip, .idx-grid-status, .frm-chip-status) {
  font-family: var(--font-family);
  font-size: var(--wm-type-body);
  line-height: var(--wm-leading-text);
  font-weight: var(--wm-weight-medium);
  letter-spacing: normal;
  text-transform: none;
}
/* Native controls and sidebar labels use the same text face. Icon fonts remain intact. */
body.authenticated :is(input, select, textarea, button),
:is(.dtl-v2, .idx-v2, .ord-v2, .frm-v2, .wm-page-shell) :where(input, select, textarea, button) { font-family: var(--font-family); }
body.authenticated :is(#dashboardSidebar, #mobileSidebar, [data-mobile-shell]) { font-family: var(--font-family); }
body.authenticated :is(#dashboardSidebar, #mobileSidebar) :is(a, button) { font-size: var(--wm-type-body); }
body.authenticated :is(#dashboardSidebar, #mobileSidebar) .uppercase { font-size: var(--wm-type-label); }

/* Shared form controls. Page utilities may arrange a field, but do not create
   separate font scales or inset shadows for the same kind of input. */
:is(input, select, textarea):is(.wm-input, .frm-input, .idx-input, .idx-select, .idx-date, .sf-input, .sf-select, .sf-textarea, .form-control, .form-input, .form-select) {
  font-family: var(--font-family);
  font-size: var(--wm-type-body);
  font-weight: var(--wm-weight-regular);
  line-height: var(--wm-leading-text);
  letter-spacing: normal;
  border-width: 1px;
  border-radius: var(--radius-md);
  box-shadow: none;
}
:is(input, textarea):is(.wm-input, .frm-input, .idx-input, .sf-input, .sf-textarea, .form-control, .form-input)::placeholder {
  font: inherit;
  color: var(--theme-text-tertiary);
  opacity: 1;
}
:is(input, select, textarea):is(.wm-input, .frm-input, .idx-input, .idx-select, .idx-date, .sf-input, .sf-select, .sf-textarea, .form-control, .form-input, .form-select):focus-visible {
  outline: 2px solid var(--border-accent);
  outline-offset: 2px;
}
:is(body.authenticated #main-content, .sf, .frm-v2, .wm-page-shell) :is(.frm-label, .sf-field-label, .wm-field-label) {
  font-size: var(--wm-type-body);
  font-weight: var(--wm-weight-medium);
  line-height: var(--wm-leading-text);
}
/* Screen tables share one readable header/body scale. Semantic alignment,
   selected rows, validation and print layouts remain owned by their components. */
@media screen {
  :is(body.authenticated #main-content, .wm-page-shell, .sf) table :is(th, td) {
    font-family: var(--font-family);
    font-size: var(--wm-type-body);
    line-height: var(--wm-leading-text);
    letter-spacing: normal;
  }
  :is(body.authenticated #main-content, .wm-page-shell, .sf) table th {
    font-weight: var(--wm-weight-strong);
    text-transform: none;
  }
}
