/* Shared UI scale. Printed documents have independent layouts and do not load this file. */
:root {
    --ui-font-meta: .75rem;     /* 12 px: supporting text */
    --ui-font-body: .8125rem;  /* 13 px: primary content */
    --ui-font-control: 1rem;   /* 16 px: editable fields */
    --ui-font-section: 1rem;  /* 16 px: section headings */
    --ui-font-title: 1.25rem; /* 20 px: page headings */
    --ui-font-metric: 1.5rem; /* 24 px: primary dashboard values */
    --ui-font-action: .75rem; /* 12 px: action labels */
    --ui-font-label: .75rem;  /* 12 px: field labels */
    --ui-control-height: 40px;
}
body { font-size: var(--ui-font-body); line-height: 1.5; }
/* Semantic roles override earlier module-specific sizes without changing colors or layout. */
body :is(.admin-page-header,.listing-page-header,.auth-card) h1,
body .auth-card-title { font-size: var(--ui-font-title); line-height: 1.25; }
body :is(.section-title,.form-section-title,.panel-title,.nd-module h2),
body .table-header h3 { font-size: var(--ui-font-section); line-height: 1.3; }
body :is(.input-label,.field > label,.nd-field label,.fee-confirmation label) {
    font-size: var(--ui-font-label); line-height: 1.5;
}
body :is(.admin-content,.auth-card,.nd-module) :is(input,select,textarea):not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=range]):not([type=color]) {
    font-size: var(--ui-font-control); line-height: 1.5; min-height: 44px;
}
body:is(.admin-body,.guest-body) :is(.btn-primary,.btn-secondary,.btn-danger,.admin-button,.customer-action-button,.mobile-record-toggle,.mobile-filter-toggle,.table-action-menu__item) {
    font-size: var(--ui-font-action); line-height: 1.4;
}
body :is(.admin-nav-link,.admin-subnav-link,.admin-sidebar__logout,.admin-sidebar__user-name) {
    font-size: var(--ui-font-body); line-height: 1.5;
}
body :is(.input-help,.field-help,.form-help,.table-meta,.customer-muted-line,.customer-summary-meta,.customer-filter-meta,.badge,.nd-muted,.text-xs,.text-\[11px\]) {
    font-size: var(--ui-font-meta); line-height: 1.5;
}
body :is(.table-title,.customer-name,.customer-data-primary,.table-actions,.listing-result-count,.contracts-result-count,.customers-result-count) {
    font-size: var(--ui-font-body); line-height: 1.5;
}
body :is(.table-shell,.customer-table,.nd-inventory-window) :is(th,td) { font-size: var(--ui-font-body); line-height: 1.5; }
/* The map canvas and SVG diagrams retain their zoom-relative annotations. UI chrome stays readable. */
body .nd-planner :is(.nd-tool span,.nd-layer-panel,.nd-map-summary,.nd-inspector p,.nd-equipment-card,.nd-diagram-footer,.nd-trace) {
    font-size: var(--ui-font-meta); line-height: 1.5;
}
body .nd-planner :is(.nd-navigation a,.nd-toolbar,.nd-toolbar select,.nd-diagram-tools button,.nd-diagram-tools a,.nd-inspector-actions,.nd-window-header h2,.nd-inventory-window) {
    font-size: var(--ui-font-body); line-height: 1.5;
}
body .nd-module:not(.nd-planner) { font-size: var(--ui-font-body); }
body .nd-module:not(.nd-planner) p { font-size: var(--ui-font-body); line-height: 1.5; }
@media(max-width:540px) {
    /* This icon-only sidebar has accessible names; preserve its intentional text hiding. */
    body .nd-planner .nd-navigation a { font-size: 0; }
}
body.admin-body .admin-page-header h1 { font-size: var(--ui-font-title); line-height: 1.25; }
body .admin-submenu__link { font-size: var(--ui-font-body); line-height: 1.5; }
body .text-\[11px\] { flex-shrink: 0; white-space: nowrap; }
/* Keep a short invoice identifier and its status whole as type grows. */
[data-system-list="invoices-index"] .customer-primary-cell .flex { flex-wrap: wrap; }
[data-system-list="invoices-index"] .customer-primary-cell .customer-name { white-space: nowrap; }
body .nd-module :is(.nd-field label,.nd-cable-section summary),
body .nd-planner :is(.nd-search-results button,.nd-layer-panel > button,.nd-explorer-filter button,.nd-pop-toolbar button,.nd-pop-footer button),
body .nd-module :is(.nd-cable-actions button,.nd-cable-route-button,.nd-cable-drawing button,.nd-cable-local-map .nd-toolbar button) {
    font-size: var(--ui-font-body); line-height: 1.5;
}
body .nd-planner .nd-planner-search input { min-width: 0; }
body small { font-size: var(--ui-font-meta); line-height: 1.5; }
body h1 { font-size: var(--ui-font-title); line-height: 1.25; }
body :is(h2,h3) { font-size: var(--ui-font-section); line-height: 1.3; }
body h4 { font-size: var(--ui-font-control); line-height: 1.4; }
body .text-lg { font-size: var(--ui-font-section); }
body .text-3xl { font-size: var(--ui-font-metric); }
/* Flexible headers must accommodate longer text at the shared type size. */
.admin-page-header__main,.admin-page-header__copy { min-width: 0; max-width: 100%; }
.admin-page-header__copy p { overflow-wrap: anywhere; }
.bank-detail-period { display: grid; grid-template-columns: minmax(0,1fr); gap: 16px; }
.bank-detail-period > * { min-width: 0; }
@media(min-width:1024px) { .bank-detail-period { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media(min-width:1440px) { .bank-detail-period { grid-template-columns: repeat(3,minmax(0,1fr)); } }
.admin-header-stat-row { grid-template-columns: repeat(auto-fit,minmax(min(100%,140px),1fr)); }
.admin-header-stat__label { white-space: normal; overflow-wrap: anywhere; }

/* Compact sidebar text, with the same generous click/touch target. */
body .admin-sidebar :is(.admin-nav-link,.admin-submenu__link) {
    font-size: var(--ui-font-meta);
    line-height: 1.5;
    min-height: 44px;
}

body .nd-planner :is(.nd-search-results button,.nd-layer-panel > button,.nd-explorer-filter button,.nd-pop-toolbar button,.nd-pop-footer button,.nd-diagram-tools button,.nd-diagram-tools a),
body .nd-module :is(.nd-cable-actions button,.nd-cable-route-button,.nd-cable-drawing button,.nd-cable-local-map .nd-toolbar button) {
    font-size: var(--ui-font-action);
}

body .text-sm { font-size: var(--ui-font-body); }
body :is(.admin-content,.auth-card) label,
body .nd-module .nd-field label {
    font-size: var(--ui-font-label); line-height: 1.5;
}

/* Compact single-line fields. Multiline fields retain their content-driven height. */
body :is(.admin-content,.auth-card,.nd-module) :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=range]):not([type=color]):not([type=submit]):not([type=button]):not([type=reset]):not([type=image]),select:not([multiple]):not([size])),
body .nd-module #nd-form .nd-field :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=range]):not([type=color]):not([type=submit]):not([type=button]):not([type=reset]):not([type=image]),select:not([multiple]):not([size])) {
    height: var(--ui-control-height);
    min-height: var(--ui-control-height);
    padding-block: 6px;
    box-sizing: border-box;
}
body :is(.admin-content,.auth-card,.nd-module) :is(.input-static,.input-text:not(input,select,textarea)) {
    min-height: var(--ui-control-height);
    padding-block: 6px;
}
@media(max-width:767px), (pointer:coarse) {
    :root { --ui-control-height: 44px; }
}

/* Column names and their mobile-card equivalents share the supporting-text scale. */
body .admin-content table th,
body .nd-inventory-window table th,
body .admin-content .is-mobile-card-table td::before {
    font-size: var(--ui-font-meta);
    line-height: 1.4;
    letter-spacing: .04em;
}
