/* Shared text roles. Load after component styles in every layout. */
:root{
  --text-h1:32px;
  --text-h2:24px;
  --text-h2-compact:20px;
  --text-h3:18px;
  --text-body:16px;
  --text-description:14px;
  --text-label:12px;
  --text-control:16px;
  --text-table:16px;
  --text-table-heading:12px;
  --text-form-label:12px;
  --text-metadata:14px;
  --text-modal:20px;
  --text-value:24px;
  --weight-page:650;
  --weight-heading:650;
  --weight-control:650;
  --weight-field:550;
  --space-section:24px;
  --space-field:16px;
  --panel-padding:24px;
  --control-radius:8px;
  --filter-background:#f2f2f2;
  --filter-foreground:#282828;
  --filter-selected-background:#181818;
  --filter-selected-foreground:#fff;
  font-size:var(--text-body);
}
/* Dashboard text roles follow Payments Overview; public and print layouts
   retain their own scale. Component layouts and navigation stay independent. */
.app-shell,.action-dialog{
  --text-h1:30px;
  --text-h2:18px;
  --text-h2-compact:18px;
  --text-h3:18px;
  --text-body:15px;
  --text-description:13px;
  --text-label:12px;
  --text-control:14px;
  --text-table:14px;
  --text-table-heading:13px;
  --text-form-label:14px;
  --text-metadata:12px;
  --text-modal:22px;
  --text-value:30px;
  --weight-page:700;
  --weight-heading:600;
  --weight-control:600;
  --weight-field:500;
  --muted:#746e72;
  font-size:var(--text-body);
  line-height:1.5;
}
.action-dialog:is(.settings-dialog,.staff-create-dialog,:has([data-settings-form],[data-settings-package])){
  --text-control:16px;
  --text-table:16px;
  --text-form-label:16px;
}
.action-dialog.settings-dialog :is(.settings-profile-subtitle,.catalogue-service-select strong),
:root body .action-dialog:is(.settings-dialog,.staff-create-dialog,:has([data-settings-form])) .avatar.staff-avatar:not(.profile-avatar),
.action-dialog:has([data-settings-package]) .service-quantity-unit{
  font-size:var(--text-control);
}
body{font-size:var(--text-body);line-height:1.55}
/* White content surfaces; functional control and data colors stay independent. */
:root body:has(>.app-shell){background-color:var(--white)}
:root body :is(.app-shell,.action-dialog) :is(
  .main,.panel,.metric-card,.form-panel,.detail-panel,.task-card,.kanban-column,
  .data-table th,.data-table tbody tr,.data-table tfoot,.receipt-table th,
  .readonly-input,.sale-total,.date-tile,.access-explainer,.client-checkbox,
  .calendar-weekdays>div,.calendar-day,.calendar-event,
  .work-order-expense-row,.settings-content,.settings-staff-editor,
  .catalogue-items-table tr[data-editing],.catalogue-add-row,
  .dashboard-record:hover,.operational-project:hover,.operational-activity:hover,
  .priority-row:hover,.simple-list-row[href]:hover
){background-color:var(--white)}
input[type="number"]{appearance:textfield;-moz-appearance:textfield}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button{appearance:none;-webkit-appearance:none;margin:0}
.time-input{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;min-width:0}
.time-input>.input{min-width:0;width:100%;padding-inline:8px}
:root body :is(h1,.page-heading h1,.heading-with-avatar h1,.receipt-page-actions h1,.error-page h1,.auth-story h1,.login-intro h1){font-size:var(--text-h1);font-weight:var(--weight-page);line-height:1.2;overflow-wrap:anywhere}
:root body :is(h2,.panel-heading h2,.detail-panel h2,.calendar-month h2,.receipt-heading h2,.payment-receipt-header h2,.auth-form-wrap h2,.dialog-header h2){font-size:var(--text-h2);font-weight:var(--weight-heading);line-height:1.3;overflow-wrap:anywhere}
:root body :is(.form-panel h2,.dialog-page .form-panel h2,.kanban-heading h2,.team-card h2,.settings-grid .detail-panel h2){font-size:var(--text-h2-compact);line-height:1.35}
:root body :is(h3,.detail-panel h3,.empty-state h3,.small-empty h3,.task-card h3,.upcoming-item h3,.form-aside h3,.studio-note h3){font-size:var(--text-h3);font-weight:var(--weight-heading);line-height:1.4;overflow-wrap:anywhere}
:root body .dialog-title{font-size:var(--text-modal);font-weight:var(--weight-heading);line-height:1.35}
:root body .staff-create-dialog .dialog-title{font-size:20px}

/* Primary reading, values, navigation and controls. */
:root body :is(
  .nav-item,.account-menu-item,.text-audit,.readonly-input strong,.team-email,.client-checkbox,
  .assigned-people>div,.simple-list-row strong,.priority-title strong,.agenda-title strong,.calendar-event>strong,.day-number,
  .operational-project strong,.operational-activity strong,.operational-attention>div,.operational-attention>a,
  .payment-method-summary>div:first-child,.payment-method-summary>div:first-child>span,.payment-project-summary strong,
  .detail-list dd,.project-detail-list dd,.internal-finance,.metric-top,.access-explainer strong,
  .receipt-document,.receipt-information dd,.receipt-identifiers dd,.receipt-parties strong,.receipt-table td,.receipt-link-box input,
  .receipt-header .receipt-business-name,.receipt-footer strong,.receipt-total>span,.alert,.dialog-message,.dialog-progress,
  .user-card strong,.public-receipt-toolbar>span
){font-size:var(--text-body);line-height:1.5}

/* Controls and tables have their own readable, compact scale. */
:root body :is(
  .input,.input.month-input,.field .input,.readonly-input,.global-search input,
  .login-form input,.login-form .input,.login-continue,.btn,.btn.small,.form-actions .btn,.login-form .btn,
  .task-status-form .btn,.task-status-form .input,.text-link,.back-link,.panel-wide-link,.tab,.settings-tabs .tab,
  .settings-nav-link,.settings-inner-tabs a,.filter-trigger,.filter-choice,.filter-editor-back,
  .date-menu-action,.date-menu-select,.date-menu-cell,.control-popover
){font-size:var(--text-control);line-height:1.5}
#main:is([data-workspace-section="project"], [data-workspace-section="work-order"], [data-workspace-section="client"]) .back-link {
  font-size:16px;
}
:root body :is(.btn,.text-link,.panel-wide-link){font-weight:var(--weight-control)}
:root body :is(.data-table,.data-table td,.data-table .amount,.table-primary){font-size:var(--text-table);line-height:1.5}
:root body :is(.field label,.client-assignment legend,.content-platform-field legend){font-size:var(--text-form-label);font-weight:var(--weight-field);line-height:1.4}

/* Descriptions, supporting metadata and helpful explanations. */
:root body :is(
  p,small,.muted,.page-heading p,.panel-heading p,.metric-meta,.form-description,.field-error,
  .confirmation-note,.page-footnote,.form-aside p,.detail-panel p,.empty-state p,.empty-inline,.toolbar p,
  .priority-title small,.simple-list-row small,.agenda-title small,.upcoming-item p,.task-description,.assignee small,.task-card .assignee small,
  .team-card>.muted,.team-client-access p,.avatar-stack>small,.access-explainer p,
  .operational-project small,.operational-activity small,.operational-attention>span,.payment-overview-controls,
  .payment-method-summary>small,.project-financials small,.internal-finance small,.panel-bottom,.source-details,.review-resolution small,
  .receipt-header p,.receipt-note p,.receipt-footer p,.payment-receipt-footer,.receipt-payment-note,.receipt-legacy-items,
  .receipt-description,.receipt-link-box label span,.copy-status,.public-receipt-end,.chart-summary span,
  .field .muted,.auth-help,.auth-story p,.auth-form-wrap>.muted,.demo-account,
  .login-intro p,.studio-note p,.sidebar-note p,.breadcrumb
){font-size:var(--text-description);line-height:1.55}

/* Labels stay compact, but never fall back to the older 7–11px sizes. */
:root body :is(
  th,.receipt-table th,.login-form label,.receipt-link-box label,.pagination-range,
  .eyebrow,.page-heading .eyebrow,.studio-note .eyebrow,.welcome-panel .eyebrow,.auth-form-wrap>.eyebrow,.auth-story .eyebrow,
  .badge,.upcoming-item .badge,.calendar-agenda .badge,.client-label,.task-card-meta>.client-label,.client-pill,
  .metric-number>small,.metric-number small,.metric-unit,.chart-legend,.chart-y-labels,.chart-x-label,.chart-bar>span,
  .date-tile span,.agenda-date>span,.calendar-weekdays>div,.calendar-legend,.calendar-legend .calendar-count,.calendar-event>small,.calendar-event>span,
  .detail-list dt,.project-detail-list dt,.readonly-input span,.receipt-information dt,.receipt-identifiers dt,
  .project-financials>article>span:not(.badge),.payment-project-summary span,.paid-stamp,.receipt-heading .paid-stamp,
  .receipt-parties .eyebrow,.receipt-note .eyebrow,.payment-receipt-footer small,.receipt-item-labels,.sale-total span,
  .kanban-heading h2>span,.team-card h2 small,.team-client-access .eyebrow,.task-due,.priority-row .task-due,
  .project-review-label,.auth-footer,.auth-small,.demo-account small,.global-search kbd,.brand>span,.user-card small,
  .operational-attention>time,.today-pill,.text-audit .muted
){font-size:var(--text-label);line-height:1.4}

:root body :is(.app-shell,.action-dialog) :is(.data-table th,.catalogue-service-table th){font-size:var(--text-table-heading);font-weight:500;line-height:1.4}
:root body :is(.app-shell,.action-dialog) :is(
  .table-secondary,small.table-secondary,.row-meta,.row-meta small,.record-number,.work-order-number,
  .task-card-footer,.task-assignee-names,.dashboard-record-context,.dashboard-record-date,
  .settings-activity-table time,.catalogue-service-status
){font-size:var(--text-metadata);line-height:1.5}
:root body :is(.task-card h3,.upcoming-item h3,.dashboard-latest-work h3){font-size:var(--text-body);font-weight:var(--weight-heading)}

/* Display values follow the same heading scale. */
:root body :is(.metric-number,.error-code){font-size:var(--text-h1);line-height:1.2}
:root body :is(.chart-summary strong,.project-financials>article>strong,.sales-summary strong,.sale-total strong,.receipt-total>strong){font-size:var(--text-value);font-weight:var(--weight-page);line-height:1.2;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}
:root body :is(.date-tile strong,.agenda-date strong){font-size:24px;line-height:1.3}
:root body .sales-summary span{font-size:var(--text-label)}
:root body .avatar{font-size:var(--text-body)}
:root body :is(.avatar.large,.heading-with-avatar .avatar.large){font-size:var(--text-h3)}
:root body :is(.avatar.tiny,.avatar.small-avatar){font-size:var(--text-label)}
:root body .password-input>button{font-size:var(--text-description)}

/* Allow larger text to grow naturally rather than shrinking at breakpoints. */
:root body .panel-heading{flex-wrap:wrap;gap:12px 20px}
:root body .panel-heading>div{min-width:0}
:root body :is(.btn,.btn.small){min-height:44px}
:root body :is(.app-shell,.action-dialog) .btn.small:not(.see-more){min-height:36px;padding:8px 12px}
:root body :is(.input,.readonly-input,.login-form input):not([type="checkbox"]):not([type="radio"]){min-height:44px}
:root body :is(.calendar-toolbar,.calendar-month,.calendar-legend,.heading-actions){flex-wrap:wrap}
:root body :is(.calendar-event,.priority-title,.agenda-title,.dialog-header h2){min-width:0}
:root body :is(.priority-title strong,.agenda-title strong,.receipt-information dd,.receipt-identifiers dd){overflow-wrap:anywhere}
:root body .operational-attention{font-size:var(--text-description)}
:root body .payment-method-summary>div:first-child{flex-wrap:wrap}
:root body .receipt-document .receipt-information dd.receipt-description{font-size:var(--text-description);line-height:1.55}

/* Shared secondary controls. Page navigation (.tab), Settings navigation,
   sidebar links and menu options keep their existing selection treatments. */
:where(.app-shell,.action-dialog) :is(.summary-tab,.chart-interval,.filter-chip){
  display:inline-flex;align-items:center;gap:6px;border:0;border-radius:var(--control-radius);
  padding:8px 13px;min-height:36px;max-width:100%;font-family:inherit;
  font-size:14px;font-weight:500;line-height:20px;
  background:var(--filter-background);color:var(--filter-foreground);
  transition:background-color .15s ease,color .15s ease;
}
:where(.app-shell,.action-dialog) :is(.summary-tab,.chart-interval){white-space:normal;overflow-wrap:anywhere}
:where(.app-shell,.action-dialog) :is(.summary-tab,.chart-interval):hover{background:#e6e6e6;color:var(--filter-foreground)}
:where(.app-shell,.action-dialog) :is(.summary-tab,.chart-interval):is(.active,[aria-selected="true"],[aria-pressed="true"]),
:where(.app-shell,.action-dialog) .filter-chip{background:var(--filter-selected-background);color:var(--filter-selected-foreground)}
:where(.app-shell,.action-dialog) .filter-chip:hover{background:#282828}
:where(.app-shell,.action-dialog) :is(.summary-tab,.chart-interval,.filter-chip):focus-visible{outline:2px solid #181818;outline-offset:3px;box-shadow:0 0 0 2px #fff}
:where(.app-shell,.action-dialog) :is(a,button,input,select,textarea,[tabindex]):focus-visible{outline:2px solid #181818;outline-offset:3px}
:where(.app-shell,.action-dialog) input:is([type="checkbox"],[type="radio"]){width:16px;height:16px;vertical-align:middle;accent-color:var(--red);flex-shrink:0}
:where(.app-shell,.action-dialog) .service-quantity-control:has(:focus-visible){outline:2px solid #181818;outline-offset:3px}
:where(.app-shell,.action-dialog) .data-table .amount{text-align:right;font-variant-numeric:tabular-nums}
:where(.app-shell,.action-dialog) :is(.project-list-table :is(th,td):nth-child(n+4),.work-order-table :is(th,td):nth-child(n+6),.payment-table :is(th,td):nth-last-child(-n+2),.expense-list-table :is(th,td):nth-child(5)){text-align:right}

@media(max-width:760px){
  .app-shell,.action-dialog{--text-modal:20px}
  :root body .page-heading{flex-wrap:wrap;align-items:flex-start}
  :root body .page-heading .heading-actions{width:100%;flex-wrap:wrap}
  :root body :is(.page-heading .text-link,.panel-heading .text-link){white-space:normal}
  :root body :is(.priority-row,.simple-list-row,.calendar-month){flex-wrap:wrap}
  :root body .priority-title{flex-basis:calc(100% - 36px)}
  :root body .dialog-header{align-items:flex-start}
  :root body .dialog-header h2{padding-top:2px}
  :root body .payment-overview-controls>.inline-form{gap:10px}
}
@media(prefers-reduced-motion:reduce){
  :where(.app-shell,.action-dialog) :is(.summary-tab,.chart-interval,.filter-chip){transition:none}
}
@media print{
  :root{font-size:var(--text-body)}
  :root body .receipt-document{font-size:var(--text-body)}
  :root body .payment-receipt-header h2{font-size:var(--text-h2)}
}

/* Keep headings and cards compact when supporting copy is absent. */
:root body .page-heading h1:last-child,
:root body .panel-heading h2:last-child{margin-bottom:0}
:root body .metric-card:not(:has(.metric-meta)) .metric-number{margin-bottom:0}
:root body .project-financials>article>strong:last-child,
:root body .empty-state :is(h2,h3):last-child{margin-bottom:0}
:root body .small-empty{padding:24px 20px}
:root body .field-action{display:table;margin-top:8px}
:root body .form-layout:not(:has(>.form-aside)):not(:has(>section+section)){grid-template-columns:minmax(0,720px)}
:root body .panel-heading h2+.badge{margin-top:8px}
@media(max-width:760px){
  :root body .toolbar .tabs{flex-wrap:wrap;max-width:100%;min-width:0}
}
