/* Shared application typography. See AGENTS.md. Load after page styles. */
:root {
  --cc-font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --cc-font-title: 16px;
  --cc-font-item: 12px;
}

/* Keep legacy inline styles from introducing additional text sizes. */
body,
body :where(*:not(.msr):not(.material-symbols-rounded):not(.material-icons):not(.fa):not(.fas):not(.far):not(.fab):not([class*="fa-"]):not(svg):not(svg *)) {
  font-family: var(--cc-font-family) !important;
  font-size: var(--cc-font-item) !important;
}

body :is(h1,h2,h3,h4,h5,h6,.cc-topbar-title,.rec-card-title,.page-title,.form-section,.rec-sub-hd,.cc-pen-header,.sb-title,.confirm-title,.up-card-title,.sidebar-heading,.text-title) {
  font-size: var(--cc-font-title) !important;
  font-weight: var(--cc-font-title-weight, 600);
}

body :is(th,.rf-label) { font-weight: 600; }
body :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),select,button) {
  min-height: 30px;
}
body :is(textarea,.rf-val,.hb-val,.yard-contact-preview) { line-height: 1.5; }
body :is(.bill-table,.cc-table) :is(th,td) { padding-top: 6px; padding-bottom: 6px; }
body .rf-label { line-height: 1.5; overflow-wrap: anywhere; }

body :is(#cc-sidebar .nav-cn,.nav-menu a,.nav-menu a small,.nav-menu button,.nav-menu .nav-disabled) {
  font-size: calc(var(--cc-font-item) - 1px) !important;
}

/* Bill items and data retain their size difference from other pages. */
body.cc-bill-page {
  --cc-font-item: 13px;
  --cc-font-data: calc(var(--cc-font-item) + 2px);
}
/* Use regular weight for items, preserving title and icon weights. */
body:is(.cc-bill-page,:has(.cargo-workspace)),
body:is(.cc-bill-page,:has(.cargo-workspace)) :where(*:not(h1,h2,h3,h4,h5,h6,.cc-topbar-title,.rec-card-title,.page-title,.form-section,.rec-sub-hd,.cc-pen-header,.sb-title,.confirm-title,.up-card-title,.sidebar-heading,.text-title,.msr,.material-symbols-rounded,.material-icons,.fa,.fas,.far,.fab,[class*="fa-"],svg,svg *)) {
  font-weight: 400 !important;
}
body.cc-bill-page #billTbody tr[data-index] :is(td,td span:not(.msr):not(.material-symbols-rounded):not(.material-icons),td a) {
  font-size: var(--cc-font-data) !important;
}

body.cc-bill-page.bill-record-open,
body:has(.cargo-workspace),
.bill-editor-embed body[data-document-embed] {
  --cc-font-title:17px;
  --cc-font-title-weight:700;
}
/* The bill editor and cargo use the same item and data scale. */
body:is(.cc-bill-page.bill-record-open,:has(.cargo-workspace)) {--cc-editor-data-offset:3px;}
body:has(.cargo-workspace) {
  --cc-font-data:calc(var(--cc-font-item) + var(--cc-editor-data-offset));
}
body.cc-bill-page #recordSection :is(.rf-val,.hb-val,.yard-contact-preview),
body.cc-bill-page #recordSection :is(.rf-val,.hb-val,.yard-contact-preview) :where(span,a,strong,b),
body.cc-bill-page #recordSection :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),select,option,textarea),
body .cargo-workspace :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),select,option,textarea,.cargo-date-value,.cargo-unit-label,.cargo-quantity-totals dd,.cargo-grid-table td,.cargo-grid-table td .cargo-bulk-description,#cargoShipmentData .rf-val,#cargoShipmentData .cargo-shipment-unit),
body .cargo-workspace .cargo-quantity-totals dd :where(*),
body:has(.cargo-workspace) .shipment-header :is(.hdr-client,.hdr-kv),
body :is(#topbarRecord,.cargo-topbar) .bill-job-number > span {
  font-size: var(--cc-font-data) !important;
  font-weight: 500 !important;
}

body.cc-bill-page #topbarRecord {
  --cc-font-item:12px;
  --cc-font-data:calc(var(--cc-font-item) + 2px);
}
/* The shared job control uses item-size arrows and data-size identifiers. */
body .bill-record-nav {--cc-font-item:12px;--cc-font-data:calc(var(--cc-font-item) + var(--cc-editor-data-offset, 2px));font-weight:400;}
body .bill-record-nav .bill-job-number > span {font-size:var(--cc-font-data)!important;}

/* AR/AP data uses the shared item size plus 2px. */
body.cc-subledger-page {--cc-font-data:calc(var(--cc-font-item) + 2px);}
body.cc-subledger-page :is(#arTable,#apTable) tbody :is(td,td :where(a,b,strong,span:not(.pill-ac,.pill-ck))),
body.cc-subledger-page :is(#arTable,#apTable,#companyModalBackdrop,#blModalBackdrop,#genInvoiceBackdrop)
  :is(input:not([type=checkbox]):not([type=hidden]),select,option,textarea),
body.cc-subledger-page :is(#companyModalList,#blModalList,#genCompanyList) .select-list-item,
body.cc-subledger-page :is(#summaryBar strong,#genMasterBL,.subledger-data) {
  font-size:var(--cc-font-data)!important;
}
body.cc-subledger-page input::placeholder {font-size:var(--cc-font-item);}

body .shipment-header :is(.hdr-client,.hdr-kv) {
  font-size:var(--cc-font-data)!important;
}

/* Entry forms inherit the editor scale when set. */
body .cc-entry-layout {--cc-font-item:12px;--cc-font-data:calc(var(--cc-font-item) + var(--cc-editor-data-offset, 2px));}
body .cc-entry-layout :is(.rf-val,.hb-val,.cc-entry-context-value,dd,input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select,option,textarea) {
  font-size:var(--cc-font-data)!important;
  font-weight:400;
}
