/* Neutral ink for the signed-in light theme only. Keep the existing layout,
   semantic accents, dark theme and printable document design unchanged. */
@media screen {
  html:not([data-theme="dark"]) body.bb-app-active {
    --light-text-primary: #171717;
    --light-text-secondary: #333333;
    --light-text-muted: #595959;
    --ink: var(--light-text-primary);
    --ink2: var(--light-text-secondary);
    --ink3: var(--light-text-muted);
    --muted: var(--light-text-muted);
    --pro-ink: var(--light-text-primary);
    --pro-ink-soft: var(--light-text-secondary);
    --pro-muted: var(--light-text-muted);
    --pro-muted-soft: var(--light-text-muted);
    --human-ink: var(--light-text-primary);
    --human-copy: var(--light-text-secondary);
    --human-muted: var(--light-text-muted);
    --ui-ink: var(--light-text-primary);
    --ui-copy: var(--light-text-secondary);
    --ui-muted: var(--light-text-muted);
    --ui-faint: var(--light-text-muted);
    --phone-ink: var(--light-text-primary);
    --phone-muted: var(--light-text-muted);
    --mobile-app-muted: var(--light-text-muted);
    --signature-muted: var(--light-text-muted);
    color: var(--light-text-primary);
  }

  /* Local workspace tokens otherwise override the inherited palette. */
  html:not([data-theme="dark"]) body.bb-app-active #app-shell {
    --human-ink: var(--light-text-primary);
    --human-copy: var(--light-text-secondary);
    --human-muted: var(--light-text-muted);
    --app-heading: var(--light-text-primary);
    --app-copy: var(--light-text-secondary);
    --app-subtle: var(--light-text-muted);
  }
  html:not([data-theme="dark"]) body.bb-app-active #settings,
  html:not([data-theme="dark"]) body.bb-app-active #settings .stg-hub {
    --stg-ink: var(--light-text-primary);
    --stg-copy: var(--light-text-secondary);
    --stg-muted: var(--light-text-muted);
    --hub-ink: var(--light-text-primary);
    --hub-copy: var(--light-text-secondary);
    --hub-muted: var(--light-text-muted);
  }
  html:not([data-theme="dark"]) body.bb-app-active #reports {
    --reports-ink: var(--light-text-primary);
    --reports-copy: var(--light-text-secondary);
    --reports-muted: var(--light-text-muted);
    --reports-faint: var(--light-text-muted);
    --report-muted: var(--light-text-muted);
  }
  html:not([data-theme="dark"]) body.bb-app-active #journal {
    --journal-ink: var(--light-text-primary);
    --journal-muted: var(--light-text-secondary);
    --journal-faint: var(--light-text-muted);
  }
  html:not([data-theme="dark"]) body.bb-app-active #pos .pos-workspace {
    --pw-ink: var(--light-text-primary);
    --pw-muted: var(--light-text-muted);
  }
  html:not([data-theme="dark"]) body.bb-app-active :is(#customers, #vendors) {
    --customer-muted: var(--light-text-muted);
  }
  html:not([data-theme="dark"]) body.bb-app-active #purchaseorders .po-line-items {
    --po-line-muted: var(--light-text-muted);
  }
  html:not([data-theme="dark"]) body.bb-app-active[data-industry="logistics"] #projects {
    --logistics-ink: var(--light-text-primary);
    --logistics-muted: var(--light-text-muted);
  }

  /* Text roles, not a blanket recolor: white-on-accent buttons and selected
     navigation, links, success/warning/error indicators retain their meaning. */
  html:not([data-theme="dark"]) body.bb-app-active :is(#app-shell, .modal, .modal-overlay, [role="dialog"], #advance-modal, #payroll-run-modal)
  :is(h1, h2, h3, .page-title, .panel-title, .section-title, .item-section-hd-title):not(:where(.invoice-preview-paper, .invoice-preview-paper *, .customer-statement-pdf, .customer-statement-pdf *, .bbd-document, .bbd-document *, .bbd-report, .bbd-report *, .bbd-pdf-export-source *, .fx-rate-board *)) {
    color: var(--light-text-primary) !important;
  }
  html:not([data-theme="dark"]) body.bb-app-active :is(#app-shell, .modal, .modal-overlay, [role="dialog"], #advance-modal, #payroll-run-modal)
  :is(label, legend, th, .field-label, .form-label, .item-line-label, .bill-inline-label, .bill-ctrl-label, .po-warehouse-label, .stg-nav-group-label, .inv-kpi-label):not(:where(.invoice-preview-paper *, .customer-statement-pdf *, .bbd-document *, .bbd-report *, .bbd-pdf-export-source *, .error, .text-danger, .required, .badge *, .status-badge *)) {
    color: var(--light-text-secondary) !important;
  }
  html:not([data-theme="dark"]) body.bb-app-active :is(#app-shell, .modal, .modal-overlay, [role="dialog"], #advance-modal, #payroll-run-modal)
  :is(input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="color"]), select, textarea):not(:where(.invoice-preview-paper *, .customer-statement-pdf *, .bbd-document *, .bbd-report *, .bbd-pdf-export-source *)) {
    color: var(--light-text-primary) !important;
  }
  html:not([data-theme="dark"]) body.bb-app-active :is(#app-shell, .modal, .modal-overlay, [role="dialog"], #advance-modal, #payroll-run-modal)
  :is(input, textarea):not(:where(.invoice-preview-paper *, .customer-statement-pdf *, .bbd-document *, .bbd-report *, .bbd-pdf-export-source *))::placeholder {
    color: var(--light-text-muted) !important;
    opacity: 1;
  }
  html:not([data-theme="dark"]) body.bb-app-active #app-shell :is(
    .eyebrow, .mini-stat-label, .sidebar-account-label, .topbar-search-shortcut,
    .stg-sidebar-copy, .stg-content-desc, .stg-avatar-sub, .stg-hint, .stg-optional,
    .stg-org-brand-use, .item-section-hd-note, .quote-help-text,
    .customer-file-note, .last-saved-note--empty, .bill-notes-hint, .bill-attach-hint,
    .bill-discount-pct, .rpt-cat-count, .rpt-group-count, .inv-list-sub, .inv-kpi-sub,
    .pr-empty-sub, .bk-date-filter, .bk-legend-item, .bk-active-count,
    .bk-account-card-sub, .bk-account-card-label, .pos-empty-catalog,
    .empty-state p, .empty-state small, .table-empty-state p, .section-header p,
    .dashboard-setup-copy small, .re-page-header p, .re-tab > small, .empty-copy,
    .wh-header-sub, .wh-kpi-lbl, .tr-date-field > span, .tr-date-filter-heading small,
    .landed-cost-heading p, .signature-signer-field > span,
    .coa-register-heading p, .coa-register-counts > span, .coa-amount-dash,
    .re-field-hint, .re-form-divider small, .fa-field-hint, .pmt-list-note,
    .appear-theme-sub
  ) { color: var(--light-text-muted) !important; }
  html:not([data-theme="dark"]) body.bb-app-active #app-shell #settings .stg-hub-link:not(:hover):not(:focus-visible) {
    color: var(--light-text-secondary) !important;
  }
  html:not([data-theme="dark"]) body.bb-app-active #app-shell :is(
    .nav-item:not(.active), .nav-subitem:not(.active), .nav-group-label,
    .item-type-btn:not(.active), .pr-tab:not(.active), .customer-tab-button:not(.active),
    .sidebar-mini-grid > span, .sidebar-mini-grid > b, .dash-greeting,
    .wh-kpi-val, .empty-title, .coa-account-type > span, .line-item-copy > span
  ) { color: var(--light-text-secondary) !important; }
  html:not([data-theme="dark"]) body.bb-app-active #app-shell #settings :is(
    .stg-detail-search-launch kbd, .stg-hub-search kbd, .stg-hub-group-heading > span,
    .stg-org-card-titleblock small, .stg-org-section-heading p, .stg-org-save-note small
  ) { color: var(--light-text-muted) !important; }
  html:not([data-theme="dark"]) body.bb-app-active #app-shell :is(#po-create-panel, #inv-create-panel, #so-create-panel, #quote-create-panel, #retainer-create-panel) .field:has(> .signature-pad-wrap) > .quote-help-text,
  html:not([data-theme="dark"]) body.bb-app-active #app-shell :is(#po-create-panel, #inv-create-panel, #so-create-panel, #quote-create-panel, #retainer-create-panel) .field:has(> .signature-pad-wrap) > label span:not([class]) {
    color: var(--light-text-muted) !important;
  }
  html:not([data-theme="dark"]) body.bb-app-active #app-shell #accounts .coa-register-table th {
    color: var(--light-text-secondary) !important;
  }
  html:not([data-theme="dark"]) body.bb-app-active #app-shell #pos .pos-catalog-help kbd {
    color: var(--light-text-muted) !important;
  }

  /* The dashboard hero stays blue in light mode. Its text needs inverse ink,
     unlike headings on white surfaces; leave buttons and status chips alone. */
  html:not([data-theme="dark"]) body.bb-app-active #app-shell #dashboard .dash-header .dash-company {
    color: #ffffff !important;
  }
  html:not([data-theme="dark"]) body.bb-app-active #app-shell #dashboard .dash-header .dash-greeting {
    color: #ededed !important;
  }
}
