@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap") screen;

/*
 * Shared screen typography. Five roles; use these tokens for future UI work.
 * Audit: 881 declarations in 73 application files; no shared font scale.
 * Legacy screen styles mix 8–38px content with repeated page overrides.
 * Tables retain their existing cell sizes, line heights, padding and controls.
 * Display lettering, icons, signatures, rich-text notes and PDF/email templates
 * are intentional exceptions. Screen rules never change printed documents.
 * Keep the root size unchanged: rem also drives existing component geometry.
 */
@media screen{
  :root{
    --a2m-type-page:clamp(1.5rem,1.35rem + .5vw,1.75rem);
    --a2m-type-section:clamp(1.125rem,1.05rem + .25vw,1.25rem);
    --a2m-type-body:clamp(.875rem,.825rem + .15vw,.9375rem);
    --a2m-type-secondary:clamp(.75rem,.725rem + .075vw,.8125rem);
    --a2m-type-helper:clamp(.6875rem,.6625rem + .075vw,.75rem);
  }

  html body{
    font-size:var(--a2m-type-body);
  }

  /* Explicit shared roles outrank legacy component rules without changing
     weights, margins, colors or line heights. Do not target arbitrary spans. */
  html:root:root:root body :is(.page-title,.people-title,.a2m-type-page),
  html:root:root:root body:not(.flow-public) h1{
    font-size:var(--a2m-type-page)!important;
  }
  html:root:root:root body :is(.section-title,.card-title,.table-card-title,
    .modal-title,.global-modal h2,.global-modal h3,.a2m-type-section),
  html:root:root:root body:not(.flow-public) :is(h2,h3):not(table *){
    font-size:var(--a2m-type-section)!important;
  }

  html:root:root:root body :is(p,li,dt,dd,label,legend,.form-control,.form-select,
    .ts-control,.ts-dropdown,.modal-message,.toast-message,
    .notification-message,.clients-showcase-about,.a2m-type-body):where(:not(table *):not(.flow-hero *):not(.estimate-notes-content *)){
    font-size:var(--a2m-type-body)!important;
  }
  html:root:root:root body :is(input,select,textarea){
    font-family:inherit;
  }
  html:root:root:root body :is(input,select,textarea,.btn,.flow-button):not(table *):not([type="range"]):not([type="checkbox"]):not([type="radio"]){
    font-size:var(--a2m-type-body)!important;
  }

  html:root:root:root body :is(.page-subtitle,.sub,.subtitle,.detail-meta,
    .detail-meta p,.work-summary-meta,.portal-items-collapse-summary,
    .side-text,.sidebar-project-menu a,.flow-links a,.flow-footer a,
    .users-showcase-email,.toast-title,
    .a2m-type-secondary):not(table *){
    font-size:var(--a2m-type-secondary)!important;
  }
  html:root:root:root body :is(small,.help-text,.helper-text,.form-text,
    .field-hint,.tooltip,.tooltip-inner,[role="tooltip"],
    .dashboard-summary-kpi-label,.dashboard-summary-kpi-description,
    .clients-showcase-role,.clients-showcase-about-title,
    .users-showcase-role,.users-showcase-meta,.users-showcase-created,
    .a2m-type-helper):not(table *){
    font-size:var(--a2m-type-helper)!important;
  }

  /* Only the inherited table baseline is normalized. Explicit compact cell,
     badge and action sizes remain authoritative, including mobile rules. */
  html body table{
    font-size:min(1em,var(--a2m-type-secondary));
  }
  html:root:root:root body .dashboard-summary-kpi-value{
    font-size:var(--a2m-type-section)!important;
  }
}

/* One screen family. Authored documents, rich text, icons and signatures retain their fonts. */
@media screen{
 :root{--a2m-font-ui:"Poppins","Segoe UI",Arial,sans-serif;}
 html:root:root:root:root:root:root:root body,
 html:root:root:root:root:root:root:root body :where(*):not(:is(svg,svg *,i,[class*="fa-"],.material-icons,.material-symbols-outlined,pre,code,kbd,samp,.signature,.signature *,[class*="signature"],[class*="signature"] *,.estimate-notes-content,.estimate-notes-content *,.project-notes-content,.project-notes-content *,.estimate-notes-editor,.estimate-notes-editor *,.contract-preview,.contract-preview *,.estimate-preview,.estimate-preview *,.project-doc-preview-word,.project-doc-preview-word *,.project-doc-preview-excel,.project-doc-preview-excel *,[contenteditable="true"],[contenteditable="true"] *)){
  font-family:var(--a2m-font-ui)!important;
 }
}


/* Internal screens: exactly three content sizes. Public pages retain the legacy scale above.
 * Existing token names are aliases so components do not need local size overrides.
 * Authored documents, rich text, drawings, branding and icon geometry are exceptions.
 */
@media screen{
 body.private-app{
  --a2m-type-title:1.25rem;
  --a2m-type-general:.875rem;
  --a2m-type-detail:.75rem;
  --a2m-type-page:var(--a2m-type-title);
  --a2m-type-section:var(--a2m-type-title);
  --a2m-type-body:var(--a2m-type-general);
  --a2m-type-secondary:var(--a2m-type-detail);
  --a2m-type-helper:var(--a2m-type-detail);
 }
 html:root:root:root:root:root:root:root body.private-app{font-size:var(--a2m-type-body)!important;}
 html:root:root:root:root:root:root:root body.private-app :where(*):where(:not(:is(
  svg,svg *,canvas,canvas *,i,[class*="fa-"],.material-icons,.material-symbols-outlined,
  pre,pre *,code,code *,kbd,samp,
  [class*="signature"],[class*="signature"] *,[class*="branding"],[class*="branding"] *,[class*="logo"],[class*="logo"] *,
  .social-brand,.social-hero-clock,.social-hero-clock *,
  .icon-btn,.mini-btn,.record-action-toggle,.card-collapse-toggle,.notes-tool-btn,
  .psc-calendar-head button,.psc-agenda header button,
  .estimate-notes-content,.estimate-notes-content *, .project-notes-content,.project-notes-content *,
  .estimate-notes-editor,.estimate-notes-editor *,[contenteditable="true"],[contenteditable="true"] *,
  .contract-preview,.contract-preview *, .estimate-preview,.estimate-preview *,
  .project-doc-preview-word,.project-doc-preview-word *, .project-doc-preview-excel,.project-doc-preview-excel *,
  .room-designer,.room-designer *,#roomDesigner,#roomDesigner *,
  [style*="font-size:0"],[style*="font-size: 0"]
 ))){font-size:inherit!important;}

 html:root:root:root:root:root:root:root body.private-app :is(
  h1,h2,h3,h4,h5,h6,.page-title,.detail-title,.people-title,.section-title,.card-title,
  .table-card-title,.modal-title,.toast-title,.a2m-type-page,.a2m-type-section,
  .dashboard-summary-kpi-value
 ):not(:is(.contract-preview *,.estimate-preview *,.estimate-notes-content *,.project-notes-content *,[contenteditable="true"] *)){
  font-size:var(--a2m-type-title)!important;
 }
 /* Primary content remains body-sized even inside metadata containers. */
 html:root:root:root:root:root:root:root body.private-app :is(
  .a2m-type-body,.clients-showcase-about,.detail-meta,.detail-meta p,.record-action-label,
  .payment-last-activity > strong,.table-client-copy > span,.table-client-copy > strong,
  .room-title,.table-search,.form-control,.form-select,.ts-control,.ts-dropdown
 ){font-size:var(--a2m-type-body)!important;}

 /* Details are subordinate information, not every value inside a table. */
 html:root:root:root:root:root:root:root body.private-app :is(
  small,.a2m-type-secondary,.a2m-type-helper,.page-subtitle,.people-subtitle,.detail-subtitle,
  .subtitle,.sub,.help-text,.helper-text,.form-text,.field-hint,.tooltip,.tooltip-inner,[role="tooltip"],
  .table-cell-subtext,.table-client-project-type,.mobile-code-client-name,.estimate-relationship-label,
  .payment-last-activity > small,.work-summary-meta,.users-showcase-email,.users-showcase-role,
  .users-showcase-meta,.users-showcase-created,.clients-showcase-role,.clients-showcase-about-title,
  .dashboard-summary-kpi-label,.dashboard-summary-kpi-description,.room-meta,
  .psc-event-time,.feed-time,.feed-date,.notification-time,.record-hub-count,.record-hub-field,
  .record-list-search-label,.project-workspace-label,.project-empty-copy > span
 ):not(:is(.contract-preview *,.estimate-preview *,.estimate-notes-content *,.project-notes-content *,[contenteditable="true"] *)){
  font-size:var(--a2m-type-detail)!important;
 }
 /* Shared activity presentation, including Job Sites (independent of estimate-only CSS). */
 html:root:root:root:root:root:root:root body.private-app td.payment-last-activity > :is(strong,small){display:block!important;}
 html:root:root:root:root:root:root:root body.private-app td.payment-last-activity > strong{font-size:var(--a2m-type-body)!important;}
 html:root:root:root:root:root:root:root body.private-app td.payment-last-activity > small{font-size:var(--a2m-type-detail)!important;}
}
