/* Screen typography for the admin workspace. Proposal pages keep their document typography. */
@media screen and (min-width: 761px) {
  :root {
    --desktop-caption: 0.8125rem;
    --desktop-label: 0.875rem;
    --desktop-copy: 0.9375rem;
    --desktop-input: 1rem;
  }

  @scope (.view, .drawer-panel, dialog, .auth-card) to (#quoteDocumentPages, .quote-document-overlay, svg, .sr-only, [aria-hidden="true"]) {
    /* Legacy screens set individual component sizes at high specificity. Keep the
       control and caption roles consistent across registers, forms and drawers. */
    :is(input:not([type="checkbox"], [type="radio"], [type="file"], [type="color"], [type="range"], [type="hidden"]), textarea, select) {
      font-size: var(--desktop-input) !important;
    }
    :is(input, textarea)::placeholder {
      font-size: inherit;
      color: var(--muted);
      opacity: 1;
    }
    :is(button:not(.material-symbols-rounded, .icon-button), summary, .field-label, label:not(.sr-only), legend, .modern-select-toggle) {
      font-size: var(--desktop-label) !important;
    }
    :is(button, summary) > :is(span, strong):not([class*="material-symbol"], [class*="icon"], .sr-only, .caret, .badge) {
      font-size: inherit;
    }
    :is([role="cell"], td) { font-size: var(--desktop-copy); }
    :is(p, dd) { font-size: max(1em, var(--desktop-label)) !important; line-height: 1.45; }
    :is(em:not([class*="material-symbol"]), .deals-analytics-grid b, .deals-report-grid b, .estimator-dashboard-panel header b) {
      font-size: max(1em, var(--desktop-caption)) !important;
    }
    :is(small, dt, th, [role="columnheader"], [role="columnheader"] button, [role="columnheader"] span:not([class*="material-symbol"]),
        .table-row.header > span, .tasks-table-head > span, .drive-file-header > span, .crm-record-table-head > span) {
      font-size: var(--desktop-caption) !important;
      line-height: 1.4;
    }
    :is(.status-chip, .deal-stage-badge, .deal-attention-badge, .deal-attention-badge > span,
        .quote-status-chip, .quote-list-status, .quote-list-priority, .crm-object-chip,
        .staff-profile-status, .job-heading-status, .muted-label, .job-summary-label,
        .quote-tool-label, .quote-disclosure-action, .quote-builder-files-count,
        .admin-summary-copy em, .jobs-summary-copy em, .quote-grand-total > span,
        .deal-tag-list span, .attention-card em, .client-detail-field em) {
      font-size: var(--desktop-caption) !important;
      line-height: 1.4;
    }
    :is(.drawer-panel .crew-documents-load-state > span:not(.material-symbols-rounded), .stock-item-image-field > p > span) {
      font-size: var(--desktop-caption) !important;
    }
    :is(label.field > span:first-child:not([class*="material-symbol"], .sr-only), .inventory-detail-stock-field-label,
        .vehicle-detail-rego-preview > span, .equipment-detail-hours-preview > span,
        .field-label > span:not([class*="material-symbol"]), .settings-field > span, .staff-profile-detail-label,
        .staff-person-copy > span, .staff-directory-cell > span:not(.avatar,.status-chip), .job-team-summary > span,
        .project-contact-card-title, .address-manual-toggle > span, .client-subsection-header h3) {
      font-size: var(--desktop-label) !important;
    }
    :is(.staff-profile-detail-value,.client-money-card strong,.task-title-button strong,
        .quote-table-row :is(.quote-client-cell,.quote-contact-cell,.quote-owner-cell,.quote-followup-cell) strong,
        .quote-table-row :is(.quote-project-cell,.quote-amount-cell)) {
      font-size: var(--desktop-copy) !important;
      line-height: 1.4;
    }
    :is(.tasks-register-footer, .quote-list-footer, .quote-table-footer, .deals-list-footer,
        .inventory-table-footer, #crmRecordsFooter, #clientsDirectoryFooter) :is(span, strong):not([class*="material-symbol"]) {
      font-size: var(--desktop-caption) !important;
    }
    :is(.admin-panel-heading, .staff-profile-meta, .quote-list-status-card, .quote-value-filter-card, .upload-action-copy,
        .dashboard-priority, .client-money-card, .deal-detail-metrics article, .deals-report-kpi,
        .estimator-kpi-card header, .job-side-card-heading, .crm-detail-chip-list, .client-site-list)
        span:not([class*="material-symbol"], [class*="icon"], .sr-only, .staff-profile-mark) {
      font-size: max(1em, var(--desktop-caption)) !important;
    }
    :is(.inventory-directory-row, .crm-source-field) > :is(span:not([class*="icon"]), dd),
    :is(.staff-team-readiness-row, .client-inline-empty, .staff-profile-detail-row, .staff-profile-meta,
        .quote-followup-filters, .quote-sort-control, .quote-activity-item, .quote-dashboard-empty-state,
        .estimating-empty, .job-team-empty, .inventory-item-open, .quote-preview-cover-link) strong,
    :is(.deal-health-body b, .deal-health-ring.payment strong, .staff-team-step, #quoteBuilderBookingHeading, #quoteBuilderWorkflowHeading) {
      font-size: max(1em, var(--desktop-caption)) !important;
    }
    :is(.table-row.header,[role="row"].header,.tasks-table-head,.crm-record-table-head,.drive-file-header) {
      height: auto;
      min-height: 36px;
    }
    :is(.icon-button, button[aria-label]):focus-visible, summary:focus-visible {
      outline: 2px solid var(--focus-ring); outline-offset: 2px;
    }
  }

  #tasks-view #tasksActiveFilterSummary { margin: 4px 0 0; font-size: var(--desktop-label); line-height: 1.5; color: var(--muted); }
  #tasks-view #tasksRegisterTitle { font-size: 1.125rem; line-height: 1.35; }
  #tasks-view .tasks-workspace > .admin-panel-heading { padding: 14px 16px 4px; }
  #tasks-view .tasks-toolbar { padding: 12px 16px; }
  #tasks-view .tasks-search-field { flex: 0 1 340px; min-width: min(235px,100%); }
  #tasks-view .tasks-filter-toggle { min-height: 42px; }
  #tasks-view .tasks-table-row { height: auto; min-height: 54px; padding-block: 7px; }
  #tasks-view .tasks-table .task-cell { font-size: var(--desktop-label); line-height: 1.45; }
  #tasks-view .task-title-button small { color: var(--muted); }
  #tasks-view .task-row-actions .icon-button { min-height: 32px; height: 32px; width: 32px; }
  #tasks-view .tasks-table-row .task-job-link { white-space: normal; overflow-wrap: anywhere; line-height: 1.4; }
  #tasks-view .tasks-table-row .task-job-placeholder { color: var(--muted); font-weight: 450; }
  #tasks-view .tasks-due-card span { font-size: var(--desktop-label); }
  #tasks-view :is(.task-title-button strong, .admin-summary-copy small) {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  #jobDrawer.task-quick-drawer .task-quick-details-list dt { font-size: var(--task-quick-copy) !important; }

  .topbar .global-search-results { right: 0; left: auto; min-width: min(25rem, calc(100vw - 2rem)); }
  .global-search-result :is(strong, small) { white-space: normal; overflow-wrap: anywhere; }
  .global-search-result strong { font-size: var(--desktop-label); }
  .global-search-result :is(small, em) { font-size: var(--desktop-caption); }
  .notification-mark-all { font-size: var(--desktop-label); }
  .notification-popover-copy :is(strong, span) {
    display: block;
    overflow-wrap: anywhere;
    font-size: var(--desktop-label);
  }
  .notification-popover-copy small,
  .notification-popover-empty span:last-child { font-size: var(--desktop-caption); }
  #dashboard-view .revenue-row span { font-size: var(--desktop-caption); }

  #help-view .help-article-card summary strong,
  #help-view .help-article-body ol,
  #help-view .help-request-row strong { font-size: var(--desktop-label); }
  #help-view .help-request-row header { flex-wrap: wrap; gap: 2px 8px; }
  #help-view .help-request-row :is(strong, p) { white-space: normal; overflow-wrap: anywhere; }
  #help-view .help-request-row code { font-size: var(--desktop-caption); }

  #calendar-view :is(.appointment-view-facts dt, .appointment-attachment-row small) {
    color: var(--muted);
    font-size: var(--desktop-caption);
  }
  #calendar-view .appointment-field-error { font-size: var(--desktop-caption); }
  #calendar-view :is(.appointment-view-facts dd, .appointment-view-hero h3, .appointment-view-section h4,
      .appointment-form-section h3, .appointment-attachment-row strong) {
    color: var(--text);
    overflow-wrap: anywhere;
  }
  #calendar-view :is(.appointment-form-section h3, .appointment-view-section h4) { font-size: 1rem; }
  #calendar-view :is(.appointment-view-hero p, .appointment-view-section p) { color: var(--muted); overflow-wrap: anywhere; }
  #calendar-view .appointment-attachment-row strong { font-size: var(--desktop-label); white-space: normal; }
  #quoteForm:not(.reading-proposal) .quote-preview-toolbar-actions {
    grid-template-columns: repeat(auto-fit, minmax(min(128px, 100%), 1fr));
  }
  #quoteForm .quote-preview-toolbar-actions button {
    height: auto; min-height: 34px; white-space: normal; text-align: left;
  }
  #quoteForm #quoteBuilderServiceContexts button { flex: 1 0 auto; }
  #quoteForm :is(#quoteBuilderLevelNameLabel, .quote-service-label) {
    font-size: var(--desktop-caption); color: var(--muted);
  }
  #quoteForm .quote-builder-details-panel > details > summary.quote-builder-workflow-heading { padding-inline-end: 24px; }
  #quoteForm .quote-service-picker .quote-builder-service strong,
  #quoteForm :is(.quote-builder-level-tab, .quote-builder-service-item-copy) strong {
    font-size: var(--desktop-label);
  }
  #quoteForm :is(.quote-builder-workflow-heading, .quote-builder-service-breakdown-header) small { color: var(--muted); }
  :root:not([data-theme="dark"]) #quoteForm .quote-builder-level-tab > em { color: #21693d; }
  #settings-view :is(.permission-cell strong, .permission-header span, .settings-prerequisite strong) { font-size: var(--desktop-label); }
  #quoteForm .quote-tool-label { overflow-wrap: anywhere; }
  #quoteForm .quote-builder-close-button, #quoteForm .quote-builder-close-button > span:not(.material-symbols-rounded) { font-size: var(--desktop-label); }
  #help-view .help-history-state > div > span, #deals-view .deal-overview-documents .deals-empty > span:last-child,
  :is(.client-site-card-display > div > span,
      .crm-record-detail-head > div > span, .crm-record-detail-summary article > span, .crm-record-detail-section header > span) {
    font-size: var(--desktop-caption);
  }
  #staff-detail-view .staff-profile-facts strong, #staff-view .staff-person-cell .avatar { font-size: var(--desktop-label); }
  #jobs-view .job-value-cell small, #quotes-view .quotes-list-header p, #quotes-view .quote-list-client small { color: var(--muted); }
  :root:not([data-theme="dark"]) #calendar-view :is(.month-weekday, .month-day.muted > strong) { color: #596577; }
  :root:not([data-theme="dark"]) #calendar-view :is(.month-weekday:first-child, .month-day.sunday:not(.current) > strong) { color: #ae3838; }
  :root:not([data-theme="dark"]) #quotes-view .quote-list-status.orange { color: #8b4a08; }
  :root:not([data-theme="dark"]) #quotes-view .quote-list-status.green { color: #12673d; }
  :root[data-theme="dark"] #tasks-view .task-due.overdue { color: var(--chip-red-fg); }
  #inventory-view .inventory-directory-barcode { color: #16263c; }
  #time-view .attendance-date-input { min-width: 10.25rem; }
  #time-view #attendanceDateFilter { width: 100%; min-width: 0; padding-inline-end: 32px; }
  #calendar-view .month-day > strong, #calendar-view .month-items .compact-calendar-item strong { font-size: var(--desktop-caption); }
  #calendar-view .month-items .compact-calendar-item { min-height: 23px; height: auto; }
  #calendar-view :is(.week-grid .time-cell, .date-dot, .calendar-now-line > span, .all-day-label > span) { font-size: var(--desktop-caption); }
  :root:not([data-theme="dark"]) #calendar-view .week-grid :is(.day-head, .all-day-toggle) { color: #596577; }
  :root:not([data-theme="dark"]) #calendar-view .week-grid .day-head:nth-child(2) { color: #ae3838; }
  :root[data-theme="dark"] #calendar-view .day-head.current .date-dot { background: var(--brand-yellow); color: #1f2023; }
  :root[data-theme="dark"] #calendar-view .calendar-now-line span { color: var(--chip-red-fg); }
  #calendar-view .calendar-now-line span { left: auto; right: calc(100% + 2px); white-space: nowrap; }
  #calendar-view .month-items .month-more { min-height: 24px; padding-block: 2px; }
}

@media screen and (max-width: 760px) {
  #dashboard-view :is(.dashboard-priority span, .dashboard-priority small, .dashboard-priority-badge,
      .dashboard-compact-row em, .mini-header .status-chip, .dashboard-signin-row .status-chip,
      .dashboard-secondary-panel summary em) { font-size: 0.8125rem; }
  #dashboard-view .dashboard-secondary-panel summary em { white-space: normal; overflow-wrap: anywhere; }
  #tasks-view :is(.tasks-workspace > header p, .tasks-table-head > span, .tasks-register-footer, .tasks-pagination button) {
    font-size: 0.8125rem;
  }
  #tasks-view .task-title-button strong { white-space: normal; overflow-wrap: anywhere; }
  #tasks-view .task-title-button small { font-size: 0.8125rem; }
  #tasks-view .tasks-due-card span { font-size: 0.8125rem; }
  #help-view :is(.help-article-body ol, .help-article-card summary strong, .help-request-row strong) { font-size: 0.875rem; }
  #help-view :is(.help-article-card summary small, .help-request-row p, .help-request-row code,
      .help-request-row > .status-chip, .help-panel-heading p, .help-search-copy p) { font-size: 0.8125rem; }
  #help-view .help-request-row header { flex-wrap: wrap; gap: 2px 8px; }
  #help-view .help-request-row :is(strong, p) { white-space: normal; overflow-wrap: anywhere; }
}

@media screen {
  #dashboard-view .page-wrap { container: operations-dashboard / inline-size; }
  #dashboard-view .dashboard-main-column { container: dashboard-main / inline-size; }
  #dashboard-view .dashboard-priority > div:first-child,
  #dashboard-view .today-job-time > :is(strong, small),
  #dashboard-view .today-job-card > div :is(span, small, em) {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

@container operations-dashboard (max-width: 720px) {
  #dashboard-view .dashboard-workspace { grid-template-columns: minmax(0, 1fr); }
}

@container dashboard-main (max-width: 520px) {
  #dashboard-view .dashboard-priority {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
  #dashboard-view .dashboard-priority > div:first-child { grid-row: auto; }
  #dashboard-view .dashboard-priority-badge {
    justify-self: start;
    max-width: 100%;
    white-space: normal;
  }
  #dashboard-view .dashboard-priority-actions { justify-self: start; justify-content: flex-start; }
  #dashboard-view .today-job-card {
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 8px 12px;
  }
  #dashboard-view .today-job-card > div { grid-row: 2; grid-column: 1 / -1; }
  #dashboard-view .today-job-card .status-chip { grid-row: 1; grid-column: 2; justify-self: end; }
}

/* Sales and CRM text roles. Long record names and actions should remain readable
   in the workspace without changing the pagination or proposal document layout. */
@media screen and (min-width: 761px) {
  #quotes-view :is(.quote-list-client strong, .quote-list-value, .quote-stage-card footer strong, .quote-list-empty strong),
  #crm-view .crm-record-row strong,
  .crm-record-dialog .crm-record-detail-summary strong,
  #client-detail-view :is(.client-detail-field strong, .client-contact-name-line strong, .client-site-card-display strong, .client-history-row strong) {
    font-size: var(--desktop-copy);
    line-height: 1.4;
  }

  #quotes-view :is(.quote-list-contact, .quote-list-followup, .quote-stage-column > header strong, .quote-stage-card > button strong),
  #client-detail-view .client-action-card strong,
  #deals-view :is(.deal-team-list strong, .deal-next-action-title strong, .deal-board-card strong, .deal-board-card footer b),
  #quotes-dashboard-view :is(.quote-activity-item strong, .quote-top-row > strong, .quote-top-row b),
  #estimator-dashboard-view :is(.estimating-client-cell b, .estimating-recent-row > span b) {
    font-size: var(--desktop-label);
    line-height: 1.4;
  }

  #quotes-view :is(.quote-stage-column > header span, .quote-stage-card > button span, .quote-stage-empty),
  #quotes-dashboard-view .quote-table-toolbar > div strong,
  #clients-view :is(.client-account-location, .client-account-status),
  #client-detail-view .client-profile-meta > span,
  #deals-view :is(.deal-activity-notes-copy > span, .deal-payment-progress p span, .deal-payment-progress b, .deal-board-card > span),
  #estimator-dashboard-view :is(.estimator-chart-panel > footer strong, .estimating-urgent-pill,
      .estimating-table-row > :is(strong, b, time), .estimating-recent-row > :is(strong, b, time)) {
    font-size: var(--desktop-caption);
    line-height: 1.4;
  }

  #quotes-view :is(.quote-list-client strong, .quote-list-status, .quote-list-contact, .quote-list-followup,
      .quote-list-priority, .quote-list-next-action, .quote-list-version, .quote-stage-column > header strong,
      .quote-stage-card > button :is(strong, span, small)),
  #clients-view :is(.client-account-location, .client-account-secondary-metrics :is(small, strong)),
  #client-detail-view .client-profile-head h1,
  #crm-view .crm-record-row :is(strong, small),
  .crm-record-dialog :is(.crm-record-detail-head h2, .crm-record-detail-head p, .crm-record-detail-summary strong),
  #deals-view :is(.deal-information-list button, .deal-stage-journey strong, .deal-document-list small, .deal-board-card > :is(strong, span)),
  #quotes-dashboard-view :is(.quote-activity-item :is(strong, small, em), .quote-top-row span :is(b, small),
      .quote-project-cell, .quote-amount-cell, .quote-status-chip, .quote-owner-cell strong),
  #estimator-dashboard-view :is(.estimating-client-cell :is(b, small), .estimating-recent-row > span :is(b, small)),
  #quoteForm :is(.quote-heading-copy h2, .quote-builder-catalog-list article p, .quote-reusable-list article :is(strong, small)) {
    overflow: visible;
    overflow-wrap: anywhere;
    text-overflow: clip;
    white-space: normal;
  }

  #quotes-view .quote-list-status { border-radius: 8px; padding-block: 4px; }
  #quotes-view .quote-list-row:not(.quote-list-head) { padding-block: 6px; }
  #quotes-view :is(.quote-list-next-action, .quote-list-version) { min-height: 34px; line-height: 1.35; }
  #quotes-view .quote-list-next-action .material-symbols-rounded { flex: none; }
  #quotes-view .quote-stage-card footer { flex-wrap: wrap; }
  #quotes-view .quote-stage-empty { color: var(--muted); }
  :root:not([data-theme="dark"]) #quotes-view .quote-stage-card footer em.due-soon { color: #8b4a08; }

  #clients-view .client-account-identity > div { min-width: 0; }
  #clients-view .client-account-secondary-metrics strong { font-size: var(--desktop-label); }
  #client-detail-view .client-profile-meta > span { min-width: 0; overflow-wrap: anywhere; }
  #client-detail-view .client-detail-field strong { overflow-wrap: anywhere; }
  .client-card-action-menu .client-card-action-item { font-size: var(--desktop-label); line-height: 1.35; }

  #crm-view .crm-type-tabs button { white-space: normal; line-height: 1.35; }
  .crm-record-dialog .crm-detail-chip-list strong,
  #marketing-view #marketingMailboxStatus { font-size: var(--desktop-caption) !important; line-height: 1.45; }
  .crm-record-dialog .crm-source-field dt small { color: var(--muted); }
  #marketing-view #marketingMailboxStatus:not([hidden]) { margin-top: 6px; }
  #marketing-view .communication-entry .header-actions { flex-wrap: wrap; }

  #deals-view .deal-detail-title h2 { overflow-wrap: anywhere; }
  #deals-view .deal-stage-journey strong { line-height: 1.35; }
  #deals-view .deal-information-list button { text-align: start; }
  #deals-view :is(.deals-table th, .deals-table .deal-stage-badge, .deal-client-cell > span:last-child,
      .deal-owner-cell > span:last-child, .deals-top-card li button :is(strong, small), .deals-top-card .deal-stage-badge) {
    overflow: visible;
    overflow-wrap: anywhere;
    text-overflow: clip;
    white-space: normal;
  }
  #deals-view .deal-name-text { display: block; }
  #deals-view :is(.deal-client-cell, .deal-owner-cell) { max-width: 100%; }
  #deals-view .deal-board-column h2 { font-size: var(--desktop-label); line-height: 1.4; }
  #deals-view .deals-top-card li { grid-template-columns: 1rem minmax(0, 1fr) auto; }
  #deals-view .deals-top-card .deal-stage-badge { grid-column: 2 / -1; justify-self: start; }
  #deals-view .deal-board-card footer { flex-wrap: wrap; }
  #dealsReportDialog :is(.deals-report-card h3, .deals-report-ranking li) {
    font-size: var(--desktop-copy);
    line-height: 1.4;
  }

  #estimator-dashboard-view :is(.estimator-dashboard-panel > header h2, .estimator-chart-panel h2, .estimator-reports-panel h2) {
    font-size: var(--desktop-copy);
    line-height: 1.4;
  }
  #estimator-dashboard-view .estimator-kpi-card > strong { overflow-wrap: anywhere; }
  #estimator-dashboard-view .estimator-dashboard-panel > header { flex-wrap: wrap; }
  #estimator-dashboard-view .estimator-dashboard-panel > header button { white-space: normal; }
  #estimator-dashboard-view .estimator-reports-panel > button strong { font-size: var(--desktop-label); line-height: 1.4; }
  #estimator-dashboard-view .estimator-dashboard-panel { container: estimator-panel / inline-size; }
  #estimator-dashboard-view :is(.estimating-table-row, .estimating-recent-row) > * { overflow-wrap: anywhere; }
  #estimator-dashboard-view button:is(.estimating-table-row.won, .estimating-recent-row) {
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
  }
  #estimator-dashboard-view button:is(.estimating-table-row.won, .estimating-recent-row):is(:hover, :focus-visible) {
    background: var(--surface-soft);
  }
  #estimator-dashboard-view .estimating-urgent-pill { white-space: nowrap; }
  #estimator-dashboard-view .estimating-table-row.urgent {
    grid-template-columns: minmax(3.5rem, .7fr) minmax(4.5rem, 1fr) minmax(0, 2fr) minmax(6.5rem, 1fr) minmax(3.5rem, 1fr) auto;
  }
  #estimator-dashboard-view .estimating-table-row.won {
    grid-template-columns: minmax(4.5rem, 1fr) minmax(0, 2fr) minmax(6.5rem, 1fr) minmax(4.5rem, 1fr);
  }
  #estimator-dashboard-view .estimating-recent-row {
    grid-template-columns: minmax(4.5rem, 1fr) minmax(0, 2fr) minmax(6.5rem, 1fr) repeat(2, minmax(3.5rem, 1fr));
  }

  @container estimator-panel (max-width: 560px) {
    #estimator-dashboard-view :is(.estimating-table-row.urgent, .estimating-table-row.won, .estimating-recent-row) {
      grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
    }
    #estimator-dashboard-view :is(.estimating-client-cell, .estimating-recent-row > span) { grid-column: 1 / -1; }
  }

  #quoteForm :is(.quote-builder-service-summary-head, .quote-line-calculation,
      .quote-builder-service-breakdown-header > span, .quote-builder-catalog-list-head, .quote-builder-custom-head,
      .quote-builder-other-styles-menu > header, .quote-builder-catalog-status,
      .quote-builder-catalog-subtotal > span, .quote-reusable-catalog > header > span, .quote-reusable-list article div > span) {
    font-size: var(--desktop-caption);
    line-height: 1.4;
  }

  #quoteForm :is(.quote-builder-service-item-total, .quote-builder-build:not(.editing-lines) .quote-builder-service-item-total,
      .quote-builder-catalog-services .quote-builder-service strong, .quote-builder-catalog-list article > div:nth-child(2) strong,
      .quote-builder-other-style-total, .quote-builder-search-empty strong, .quote-builder-custom-trigger strong,
      .quote-reusable-catalog > header strong, .quote-reusable-catalog.error strong, .quote-reusable-catalog.loading strong,
      .quote-reusable-empty strong, .quote-reusable-list article strong, .quote-builder-save-reusable strong) {
    font-size: var(--desktop-label);
    line-height: 1.4;
  }

  #quoteForm .quote-builder-build:not(.editing-lines) :is(.quote-line-calculation, .quote-builder-service-breakdown-header > strong) {
    font-size: var(--desktop-caption);
  }
  #quoteForm :is(.quote-builder-catalog-unit, .quote-builder-catalog-rate, .quote-builder-catalog-total) {
    font-size: var(--desktop-label) !important;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }
  #quoteForm .quote-builder-catalog-list article > div:nth-child(2) { padding-inline-end: 0; }
  #quoteForm :is(.quote-builder-catalog-list article p, .quote-builder-other-styles-menu > header small) { color: var(--muted); }
  #quoteForm .quote-builder-catalog-list article > .quote-builder-other-styles {
    position: static;
    display: grid;
    grid-column: 2 / -1;
    justify-items: start;
  }
  #quoteForm .quote-builder-other-styles.open > .quote-builder-other-styles-toggle { margin: 0; justify-self: start; }
  #quoteForm .quote-builder-other-styles-menu { width: 100%; }
  #quoteForm .quote-reusable-list article { grid-template-columns: minmax(0, 1fr) auto minmax(44px, auto); }
  #quoteForm .quote-reusable-list article > .ghost-button { white-space: normal; }
}

@container quote-pipeline (min-width: 940px) {
  #quotes-dashboard-view .quote-table-row:not(.quote-table-head) { padding-block: 6px; }
}

@container quote-pipeline (max-width: 760px) {
  #quotes-dashboard-view .quote-table-row:not(.quote-table-head) > [data-mobile-label]::before {
    color: var(--muted);
    font-size: 0.8125rem;
    line-height: 1.4;
  }
  #quotes-dashboard-view .quote-table-row:not(.quote-table-head) { padding-inline: 14px; }
}

@media screen and (max-width: 760px) {
  #clients-view :is(.client-account-location, .client-account-status, .client-account-modern-metrics small,
      .client-account-secondary-metrics :is(small, strong), .clients-directory-footer span),
  #client-detail-view :is(.client-profile-meta > span, .client-summary-card :is(p, small), .client-detail-field em,
      .client-inline-empty small, .client-site-card-display :is(dt, div > span), .client-money-card span),
  #crm-view :is(.crm-import-state .status-chip, #archiveOverviewFacts, .crm-type-tabs button),
  #quotes-view :is(.quote-list-head :is(button, span:not(.material-symbols-rounded)), .quote-list-client small,
      .quote-list-status, .quote-list-priority, .quote-list-status-card > span, .quote-stage-card > button :is(span, small),
      .quote-stage-column > header span, .quote-stage-empty, .quote-list-footer),
  #quotes-dashboard-view :is(.quote-dashboard-empty-state small, .quote-activity-item :is(small, em),
      .quote-value-filter-card small, .quote-table-toolbar > div strong, .quote-status-chip, .quote-table-footer > span),
  #estimator-dashboard-view :is(.estimator-kpi-card header > span, .estimating-urgent-pill, .estimating-client-cell small,
      .estimating-recent-row > span small, .estimating-recent-row em, .estimator-reports-panel > button small),
  #dealsReportDialog :is(.deals-report-kpi :is(small, div > span), .deals-report-card th) {
    font-size: 0.8125rem;
    line-height: 1.4;
  }

  #clients-view :is(.clients-records-heading p, .clients-pagination button),
  #client-detail-view :is(.client-back-link, .client-detail-panel .mini-header button, .client-profile-actions button,
      .client-profile-actions summary, .client-subsection-header h3, .client-contact-copy strong,
      .client-history-row strong, .client-inline-empty strong, .client-money-card strong, .client-action-card strong),
  #quotes-view :is(.quotes-view-toggle button, .quote-list-client strong, .quote-list-number, .quote-list-value,
      .quote-list-next-action, .quote-list-version, .quote-list-contact, .quote-list-followup, .quote-list-empty strong,
      .quote-stage-card > button strong, .quote-stage-card footer strong, .quote-stage-column > header strong),
  #quotes-dashboard-view :is(.quotes-header-copy p, .quotes-date-button > span:not(.material-symbols-rounded),
      .quote-dashboard-empty-state strong, .quote-card-heading button, .quote-activity-item strong,
      .quote-value-filter-card span:not([class*="material-symbol"]), .quote-followup-filters :is(strong, button),
      .quote-sort-control strong, .quote-sort-field .modern-select-toggle span:not(.material-symbols-rounded),
      .quote-number-action, .quote-table-row :is(.quote-client-cell strong, .quote-project-cell, .quote-amount-cell,
      .quote-followup-cell strong, .quote-owner-cell strong, .quote-contact-cell strong), .quote-pagination button),
  #estimator-dashboard-view :is(.estimator-dashboard-header p, .estimator-kpi-card > :is(p, button),
      .estimator-dashboard-panel > header button, .estimating-empty strong, .estimating-client-cell b,
      .estimating-table-row > :is(strong, b, time), .estimating-recent-row > :is(strong, b, time), .estimating-recent-row > span b,
      .estimator-reports-panel > button strong),
  #dealsReportDialog :is(p, .deals-report-card td, .deals-report-ranking li) {
    font-size: 0.875rem;
    line-height: 1.4;
  }

  #clients-view .client-account-location,
  #client-detail-view .client-profile-head h1,
  #quotes-view :is(.quote-list-row > *, .quote-list-client strong, .quote-list-number, .quote-list-status,
      .quote-list-next-action, .quote-list-version, .quote-list-head button, .quote-stage-card > button :is(strong, span, small),
      .quote-stage-column > header strong),
  #quotes-dashboard-view :is(.quote-activity-item :is(strong, small, em), .quote-project-cell, .quote-amount-cell,
      .quote-status-chip, .quote-owner-cell strong),
  #estimator-dashboard-view :is(.estimating-client-cell, .estimating-recent-row > span) > :is(b, small) {
    overflow: visible;
    overflow-wrap: anywhere;
    text-overflow: clip;
    white-space: normal;
  }

  #client-detail-view .client-profile-meta > span { min-width: 0; overflow-wrap: anywhere; }
  #client-detail-view .client-detail-panel .mini-header { flex-wrap: wrap; }
  #quotes-view .quote-list-row { padding-block: 6px; }
  #quotes-view .quote-list-status { border-radius: 8px; padding-block: 4px; }
  #quotes-view .quote-stage-card footer { flex-wrap: wrap; }
  #quotes-dashboard-view .quote-activity-list { grid-template-columns: minmax(0, 1fr); }
  #quotes-dashboard-view .quote-followup-filters > div { flex-wrap: wrap; }
  #estimator-dashboard-view .estimator-dashboard-panel > header { flex-wrap: wrap; }
  #estimator-dashboard-view :is(.estimating-table-row, .estimating-recent-row) {
    width: 100%;
    min-width: 0;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 5px 12px;
    padding-block: 12px;
  }
  #estimator-dashboard-view .estimating-table-row.urgent {
    grid-template-areas: "quote status" "client client" "amount action" "updated action";
  }
  #estimator-dashboard-view .estimating-table-row.won {
    grid-template-areas: "quote updated" "client client" "amount amount";
  }
  #estimator-dashboard-view .estimating-recent-row {
    grid-template-areas: "quote status" "client client" "amount updated";
  }
  #estimator-dashboard-view :is(.estimating-table-row, .estimating-recent-row) > strong { grid-area: quote; }
  #estimator-dashboard-view :is(.estimating-client-cell, .estimating-recent-row > span) { grid-area: client; }
  #estimator-dashboard-view :is(.estimating-table-row, .estimating-recent-row) > b { display: block; grid-area: amount; }
  #estimator-dashboard-view :is(.estimating-table-row, .estimating-recent-row) > time { display: block; grid-area: updated; }
  #estimator-dashboard-view :is(.estimating-urgent-pill, .estimating-recent-row > em) { grid-area: status; justify-self: end; }
  #estimator-dashboard-view :is(.estimating-recent-row, .estimating-table-row.won) > time { text-align: end; }
  #estimator-dashboard-view .estimating-view-button { grid-area: action; justify-self: end; min-height: 44px; }
  #estimator-dashboard-view :is(.estimating-table-row, .estimating-recent-row) > * { min-width: 0; overflow-wrap: anywhere; }
  #estimator-dashboard-view button:is(.estimating-table-row.won, .estimating-recent-row) {
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
  }
}

@media screen {
  #estimator-dashboard-view .estimating-view-button { background: var(--surface); }
  :root[data-theme="dark"] #estimator-dashboard-view :is(.estimating-urgent-pill, .estimating-view-button) { color: var(--chip-red-fg); }
  :root[data-theme="dark"] #estimator-dashboard-view .estimator-kpi-card:is(.green, .emerald) > button { color: var(--chip-green-fg); }
}

@media screen {
  #tasks-view .task-title-button > small,
  #dashboard-view .dashboard-secondary-panel > summary > em {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  #emails-view .settings-prerequisite strong,
  #settings-integrations .settings-subheader .settings-inline-note,
  .view .form-alert > div > span,
  #equipmentAssetTable .form-alert > span:not(.material-symbols-rounded) {
    font-size: 0.875rem;
    line-height: 1.4;
  }
}

@media screen and (max-width: 760px) {
  #jobs-view .phone-card .status-chip,
  #tasks-view #tasksActiveFilterSummary,
  #dashboard-view :is(.dashboard-priority > div > span, .dashboard-priority small,
      .dashboard-priority-badge, .status-chip, .dashboard-compact-row em, .dashboard-secondary-panel > summary > em),
  #help-view :is(.help-panel-heading p, .status-chip),
  #client-detail-view .client-history-row small {
    font-size: 0.8125rem;
    line-height: 1.4;
  }
  #create-project-view .inline-checkbox.small-checkbox,
  #staff-detail-view .staff-profile-actions > button:is(.ghost-button, .primary-button),
  #client-detail-view .client-detail-panel .mini-header > button.compact-button,
  #quotes-dashboard-view .quotes-header-actions button > span:not(.material-symbols-rounded),
  #quotes-view .quotes-list-actions button > span:not(.material-symbols-rounded) {
    font-size: 0.875rem;
    line-height: 1.4;
  }
}

@media screen {
  #clients-view .clients-directory-toolbar .clients-directory-search,
  #clients-view .clients-directory-toolbar .workspace-filters > summary {
    min-height: 44px;
    box-sizing: border-box;
  }
  #quotes-view .quotes-list-actions {
    align-items: stretch;
  }
  #quotes-view .quotes-list-actions > button {
    min-height: 44px;
    height: auto;
  }
}

@media screen and (max-width: 760px) {
  #clients-view .clients-directory-toolbar .workspace-filters > summary {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    cursor: pointer;
    list-style: none;
  }
  #clients-view .clients-directory-toolbar .workspace-filters > summary::-webkit-details-marker {
    display: none;
  }
  #clients-view .clients-directory-toolbar .workspace-filters > summary::after {
    content: "";
    flex: none;
    width: 7px;
    height: 7px;
    margin-inline-start: auto;
    border: solid var(--muted);
    border-width: 0 1.5px 1.5px 0;
    transform: translateY(-2px) rotate(45deg);
  }
  #clients-view .clients-directory-toolbar .workspace-filters[open] > summary::after {
    transform: translateY(2px) rotate(225deg);
  }
}

@container clients-directory (max-width: 700px) {
  #clients-view .clients-directory-toolbar:has(> .workspace-filters:not([open])) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }
  #clients-view .clients-directory-toolbar:has(> .workspace-filters:not([open])) > .clients-directory-search {
    grid-column: 1 / -1;
  }
  #clients-view .clients-directory-toolbar > .workspace-filters:not([open]) {
    grid-column: 1;
  }
  #clients-view .clients-directory-toolbar > .workspace-filters:not([open]) + .clients-view-switch {
    grid-column: 2;
    grid-row: 2;
    gap: 4px;
    padding: 0;
  }
  #clients-view .clients-directory-toolbar > .workspace-filters:not([open]) + .clients-view-switch button {
    margin: 0;
  }
}
