/* Native work screens retain their original layouts and source workflows.
   This layer resolves legacy component colors after the shared surface/type
   refinement. All colors follow the customer's active palette and night mode. */
@layer workspace-refinement {
 /* All 26 native products use these original header variants. The Suite
    engine, Pearl overview, financial source headers and Care hero compositions
    keep their own presentation. Existing source labels/actions stay native. */
 html[data-workspace-palette] .crm-shell[data-owner-product]:not(.suite-native-shell) .crm-content :is(.page-heading,.page-head,.page-header,.vcrm-heading,.rs-heading,.auto-heading,.heading,.edu-heading,.mfg-feature-heading):has(h1):not(:where(.owner-overview *,.ops-pearl-overview *,.company-performance *,.re-finance-workspace *,.care-hero-grid *)){
  position:relative;overflow:visible!important;
  background:linear-gradient(115deg,color-mix(in srgb,var(--ui-accent) 9%,var(--ui-surface)),var(--ui-surface) 64%)!important;
  border:1px solid color-mix(in srgb,var(--ui-accent) 16%,var(--ui-line))!important;
  border-radius:var(--ui-radius)!important;padding:24px 26px!important;margin-bottom:24px!important;
  box-shadow:0 8px 30px color-mix(in srgb,var(--ui-accent) 5%,transparent)!important;
 }
 html[data-workspace-palette] .crm-shell[data-owner-product]:not(.suite-native-shell) .crm-content :is(.page-heading,.page-head,.page-header,.vcrm-heading,.rs-heading,.auto-heading,.heading,.edu-heading,.mfg-feature-heading):has(h1):not(:where(.owner-overview *,.ops-pearl-overview *,.company-performance *,.re-finance-workspace *,.care-hero-grid *))::before{
  content:'';position:absolute;inset:18px auto 18px 0;width:4px;background:var(--ui-accent);border-radius:0 4px 4px 0;
 }
 html[data-workspace-palette] .crm-shell[data-owner-product]:not(.suite-native-shell) .crm-content :is(.page-heading,.page-head,.page-header,.vcrm-heading,.rs-heading,.auto-heading,.heading,.edu-heading,.mfg-feature-heading):has(h1):not(:where(.owner-overview *,.ops-pearl-overview *,.company-performance *,.re-finance-workspace *,.care-hero-grid *))>div:first-child{padding-left:4px}
 html[data-workspace-palette] .crm-content :is(.badge.badge-green,.badge.badge-red,.badge.badge-amber,.badge.badge-blue){font-size:12px!important;font-weight:700!important;padding:5px 10px!important;border-width:1px!important;line-height:1.4!important}
 html[data-workspace-palette] .crm-content .badge.badge-green{background:color-mix(in srgb,#21835a 10%,var(--ui-surface))!important;color:#1f6746!important;border-color:color-mix(in srgb,#21835a 24%,var(--ui-line))!important}
 html[data-workspace-palette] .crm-content .badge.badge-red{background:color-mix(in srgb,#b93848 9%,var(--ui-surface))!important;color:#a32a3c!important;border-color:color-mix(in srgb,#b93848 24%,var(--ui-line))!important}
 html[data-workspace-palette] .crm-content .badge.badge-amber{background:color-mix(in srgb,#c18a27 10%,var(--ui-surface))!important;color:#835911!important;border-color:color-mix(in srgb,#c18a27 26%,var(--ui-line))!important}
 html[data-workspace-palette] .crm-content .badge.badge-blue{background:var(--ui-faint)!important;color:var(--ui-link)!important;border-color:color-mix(in srgb,var(--ui-accent) 24%,var(--ui-line))!important}
 html[data-workspace-mode=night] .crm-content .badge.badge-green{color:#a7e2be!important}
 html[data-workspace-mode=night] .crm-content .badge.badge-red{color:#ffb3be!important}
 html[data-workspace-mode=night] .crm-content .badge.badge-amber{color:#f4d18b!important}
 html[data-workspace-palette] .crm-content .table-view-tools{border-bottom:1px solid var(--ui-line)!important;border-radius:14px 14px 0 0!important}
 html[data-workspace-palette] .crm-content .table-view-tools>label{font-weight:650!important}
 html[data-workspace-palette] .crm-content .table-view-tools button[aria-pressed=true]{background:var(--ui-faint)!important;border-color:var(--ui-accent)!important;color:var(--ui-link)!important}
 html[data-workspace-palette] .crm-shell[data-owner-product=hr] .crm-content .pill:is(.present,.active,.completed,.approved){background:color-mix(in srgb,#21835a 10%,var(--ui-surface))!important;color:#1f6746!important;border-color:color-mix(in srgb,#21835a 24%,var(--ui-line))!important;font-weight:650!important}
 html[data-workspace-palette] .crm-shell[data-owner-product=hr] .crm-content .pill:is(.remote,.in_progress,.onboarding){background:var(--ui-faint)!important;color:var(--ui-link)!important;border-color:color-mix(in srgb,var(--ui-accent) 20%,var(--ui-line))!important;font-weight:650!important}
 html[data-workspace-palette] .crm-shell[data-owner-product=hr] .crm-content .pill:is(.absent,.rejected){background:color-mix(in srgb,#b93848 9%,var(--ui-surface))!important;color:#a32a3c!important;border-color:color-mix(in srgb,#b93848 24%,var(--ui-line))!important;font-weight:650!important}
 html[data-workspace-mode=night] .crm-shell[data-owner-product=hr] .crm-content .pill:is(.present,.active,.completed,.approved){color:#a7e2be!important}
 html[data-workspace-mode=night] .crm-shell[data-owner-product=hr] .crm-content .pill:is(.absent,.rejected){color:#ffb3be!important}
 html[data-workspace-palette] .crm-content :is(.vcrm-pill,.hotel-status,.rs-status){
  display:inline-flex;align-items:center;gap:6px;max-width:100%;padding:5px 10px!important;
  background:var(--ui-soft)!important;color:var(--ui-ink)!important;
  border:1px solid var(--ui-line)!important;border-radius:999px!important;
  font-size:12px!important;font-weight:650!important;line-height:1.4!important;
  vertical-align:middle;white-space:nowrap;box-shadow:none!important;
 }
 html[data-workspace-palette] .crm-content :is(.hotel-status,.rs-status):is(.checked_in,.in_service,.current,.busy){
  background:var(--ui-faint)!important;color:var(--ui-link)!important;border-color:color-mix(in srgb,var(--ui-accent) 24%,var(--ui-line))!important;
 }
 html[data-workspace-palette] .crm-content :is(.hotel-status,.rs-status):is(.completed,.checked_out,.clean){
  background:color-mix(in srgb,#417b57 10%,var(--ui-surface))!important;color:#326547!important;border-color:color-mix(in srgb,#417b57 20%,var(--ui-line))!important;
 }
 html[data-workspace-palette] .crm-content :is(.hotel-status,.rs-status):is(.cancelled,.no_show,.missed){
  background:color-mix(in srgb,#a83b48 9%,var(--ui-surface))!important;color:#983342!important;border-color:color-mix(in srgb,#a83b48 20%,var(--ui-line))!important;
 }
 html[data-workspace-mode=night] .crm-content :is(.hotel-status,.rs-status):is(.completed,.checked_out,.clean){color:#a9dfba!important}
 html[data-workspace-mode=night] .crm-content :is(.hotel-status,.rs-status):is(.cancelled,.no_show,.missed){color:#ffc0c8!important}

 /* Appointment, room, reception and roster cards share a clear hierarchy. */
 html[data-workspace-palette] .crm-content :is(.reservation-card,.booking-card,.shift-card,.rs-order,.rs-table-card,.campus-unit,.campus-card,.people-panel,.care-panel){
  background:var(--ui-surface)!important;color:var(--ui-ink)!important;
  border:1px solid var(--ui-line)!important;border-radius:var(--ui-radius)!important;
  box-shadow:var(--ui-shadow)!important;min-width:0;
 }
 html[data-workspace-palette] .crm-content :is(.reservation-card,.booking-card,.shift-card,.rs-order){padding:22px!important}
 html[data-workspace-palette] .crm-content :is(.reservation-grid,.shift-grid,.booking-grid,.rs-order-grid){gap:18px!important}
 html[data-workspace-palette] .crm-content :is(.hotel-detail,.shift-meta>div,.booking-meta>div,.rs-order-lines,.care-stat,.hr-balance){
  background:var(--ui-soft)!important;color:var(--ui-ink)!important;
  border:1px solid var(--ui-line)!important;border-radius:min(14px,var(--ui-radius))!important;
  box-shadow:none!important;
 }
 html[data-workspace-palette] .crm-content :is(.hotel-detail,.shift-meta>div,.booking-meta>div){padding:14px!important}
 html[data-workspace-palette] .crm-content :is(.hotel-details,.shift-meta,.booking-meta){gap:12px!important}
 html[data-workspace-palette] .crm-content :is(.hotel-detail,.shift-meta>div,.booking-meta>div) strong{font-weight:700!important;font-size:15px!important;line-height:1.55!important}
 html[data-workspace-palette] .crm-content .reservation-card .dates span{
  background:var(--ui-faint)!important;color:var(--ui-link)!important;
  border:1px solid color-mix(in srgb,var(--ui-accent) 18%,var(--ui-line))!important;
  border-radius:min(11px,var(--ui-radius))!important;padding:9px 11px!important;
  font-size:12px!important;font-weight:600!important;line-height:1.5!important;
 }
 html[data-workspace-palette] .crm-content :is(.rs-table-card.busy,.rs-table-card.occupied){border-color:var(--ui-accent)!important;background:var(--ui-faint)!important}
 html[data-workspace-palette] .crm-content :is(.rs-table-card.busy,.rs-table-card.occupied) :is(strong,h2,h3){color:var(--ui-link)!important}
 html[data-workspace-palette] .crm-content :is(.rs-stage,.hos-flow>span,.hospital-notice,.care-note,.people-note){background:var(--ui-soft)!important;color:var(--ui-ink)!important;border-color:var(--ui-line)!important}
 html[data-workspace-palette] .crm-content :is(.rs-order-head,.rs-order-foot,.rs-panel-head,.care-panel-heading){background:transparent!important;border-color:var(--ui-line)!important}
 html[data-workspace-palette] .crm-content .property-card{background:var(--ui-surface)!important;border-color:var(--ui-line)!important;border-radius:var(--ui-radius)!important}
 html[data-workspace-palette] .crm-content .property-card .property-art{background:linear-gradient(125deg,var(--ui-faint),var(--ui-soft))!important;color:var(--ui-link)!important}
 html[data-workspace-palette] .crm-content .property-card .property-art>svg{color:var(--ui-link)!important;opacity:.8}
 html[data-workspace-palette] .crm-content .property-art::after{border-color:color-mix(in srgb,var(--ui-accent) 15%,var(--ui-line))!important}
 html[data-workspace-palette] .crm-content :is(.property-code,.property-location){color:var(--ui-muted)!important}
 html[data-workspace-palette] .crm-content .property-card .property-price{color:var(--ui-ink)!important;font-weight:750!important;font-variant-numeric:tabular-nums}
 html[data-workspace-palette] .crm-content .property-specs{color:var(--ui-ink)!important;border-color:var(--ui-line)!important}
 html[data-workspace-palette] .crm-content .property-specs>span{background:var(--ui-soft)!important;color:var(--ui-ink)!important;border-color:var(--ui-line)!important;font-size:11.5px!important}
 html[data-workspace-palette] .crm-content .property-filter-bar{background:var(--ui-soft)!important;border-color:var(--ui-line)!important;border-radius:min(14px,var(--ui-radius))!important}
 html[data-workspace-palette] .crm-content .property-filter-bar small{color:var(--ui-muted)!important;font-size:12px!important}

 /* Factory quality, planning, inventory and routing contain nested native
    forms whose older styles used fixed blue backgrounds and focus colors. */
 html[data-workspace-palette] .crm-shell .crm-content :is(.mfg-phase-panel,.mfg-phase-settings,.mfg-cost-panel,.mfg-integrity-stat,.mfg-suite-feature,.mfg-focused-form,.mfg-workflow-form,.p4-panel,.p4-section,.p4-form,.p4-review,.mfg-routing-step,.mf-schedule-timeline){
  background:var(--ui-surface)!important;color:var(--ui-ink)!important;
  border-color:var(--ui-line)!important;border-radius:var(--ui-radius)!important;box-shadow:none!important;
 }
 html[data-workspace-palette] .crm-shell .crm-content :is(.mfg-phase-stats>div,.mfg-cost-stats article,.p4-metrics>div,.mfg-cost-form-grid .ops-form,.mfg-check-row,.ops-note){
  background:var(--ui-soft)!important;color:var(--ui-ink)!important;border-color:var(--ui-line)!important;border-radius:min(14px,var(--ui-radius))!important;
 }
 html[data-workspace-palette] .crm-shell .crm-content :is(.mfg-phase-panel,.mfg-phase-settings,.mfg-cost-panel,.mfg-focused-form,.mfg-workflow-form,.p4-panel,.p4-section,.p4-form,.p4-review) :is(legend,summary){font-weight:650!important}
 html[data-workspace-palette] .crm-shell .crm-content :is(.mfg-workflow-form,.mfg-focused-form)>summary{padding:16px 18px!important;line-height:1.6!important}
 html[data-workspace-palette] .crm-shell .crm-content :is(.mfg-workflow-form,.mfg-focused-form)[open]>summary{
  background:var(--ui-faint)!important;color:var(--ui-link)!important;border-color:var(--ui-line)!important;
 }
 html[data-workspace-palette] .crm-shell .crm-content :is(.mfg-phase-panel,.mfg-phase-settings,.mfg-cost-panel,.mfg-focused-form,.mfg-workflow-form,.p4-panel,.p4-form,.p4-review,.ops-panel) :is(input,select,textarea){
  background:var(--ui-surface)!important;color:var(--ui-ink)!important;border-color:var(--ui-line)!important;color-scheme:inherit!important;
 }
 html[data-workspace-palette] .crm-shell .crm-content :is(.mfg-phase-panel,.mfg-focused-form,.mfg-workflow-form,.ops-panel) :is(input,select,textarea,summary):focus-visible{outline:2px solid var(--ui-accent)!important;outline-offset:3px!important}
 html[data-workspace-palette] #mfg-quality-inspections [data-parameter]{background:var(--ui-soft)!important;border-color:var(--ui-line)!important;border-radius:min(14px,var(--ui-radius))!important;padding:18px!important}
 html[data-workspace-palette] #mfg-quality-inspections [data-parameter]:focus-within{border-color:var(--ui-accent)!important}
 html[data-workspace-palette] .crm-shell .crm-content .ops-form>:is(h3,p,.capture-panel,[data-form-customization-actions],.inline-record-fields){grid-column:1/-1!important}
 html[data-workspace-palette] #mfg-quality-inspections :is([data-inspection-plan],[data-inspection-measurement]){display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:18px!important;padding:20px 0!important;border-top:1px solid var(--ui-line)!important}
 html[data-workspace-palette] #mfg-quality-inspections [data-parameters]{grid-column:1/-1!important;display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,320px),1fr));gap:16px;min-width:0}
 html[data-workspace-palette] #mfg-quality-inspections [data-parameter]{grid-template-columns:repeat(3,minmax(0,1fr))!important;margin:0!important}
 html[data-workspace-palette] #mfg-quality-inspections [data-parameter]>legend{padding:0 6px!important}
 html[data-workspace-palette] #mfg-quality-inspections .ops-form>.btn{justify-self:start!important;align-self:end!important;width:auto!important}
 html[data-workspace-palette] .mf-timeline-track{background:var(--ui-soft)!important;border:1px solid var(--ui-line)!important}
 html[data-workspace-palette] .mf-timeline-track>span{background:var(--ui-accent)!important}
 html[data-workspace-palette] .mf-timeline-slot{border-color:var(--ui-line)!important}
 html[data-workspace-palette] .mf-timeline-slot summary:focus-visible{outline-color:var(--ui-accent)!important}

 /* Native guidance, lab filters and custom sections preserve their semantic
    grouping without introducing a second visual system inside the workspace. */
 html[data-workspace-palette] .crm-content :is(.specialty-choice,.specialty-status,.specialty-steps a,.campus-unit,.people-source,.people-draft,.diagnostics-record){border-color:var(--ui-line)!important;color:var(--ui-ink)!important}
 html[data-workspace-palette] .crm-content :is(.specialty-choice,.specialty-status,.specialty-steps a){background:var(--ui-surface)!important;border-radius:var(--ui-radius)!important}
 html[data-workspace-palette] .crm-content :is(.specialty-choice,.specialty-steps a):hover{border-color:var(--ui-accent)!important;background:var(--ui-faint)!important}
 html[data-workspace-palette] .crm-content :is(.people-source blockquote,.care-alert){border-color:var(--ui-accent)!important;background:var(--ui-faint)!important;color:var(--ui-ink)!important}
 html[data-workspace-palette] .crm-content :is(.diagnostics-filters,.wa-operations-filter,.wa-roster-selector){
  background:var(--ui-soft)!important;border:1px solid var(--ui-line)!important;border-radius:min(16px,var(--ui-radius))!important;padding:18px!important;
 }
 html[data-workspace-palette] .crm-content :is(.diagnostics-filters,.wa-operations-filter,.campus-form,.people-panel,.care-form) :is(input,select,textarea){border-color:var(--ui-line)!important;background:var(--ui-surface)!important;color:var(--ui-ink)!important}
 html[data-workspace-palette] .crm-content :is(.wa-coverage-gap,.diagnostics-overdue){color:var(--ui-link)!important;font-weight:700!important}
 html[data-workspace-palette] .crm-content .care-bar.revenue{background:var(--ui-accent)!important}
 html[data-workspace-palette] .crm-content .care-bar.cost{background:color-mix(in srgb,var(--ui-accent) 35%,var(--ui-soft))!important}
 html[data-workspace-palette] .crm-content .care-revenue{fill:var(--ui-accent)!important}
 html[data-workspace-palette] .crm-content .care-cost{fill:color-mix(in srgb,var(--ui-accent) 35%,var(--ui-soft))!important}
 html[data-workspace-palette] .crm-content .care-chart-grid{stroke:var(--ui-line)!important}
 html[data-workspace-palette] .crm-content .care-legend i:first-child{background:var(--ui-accent)!important}
 html[data-workspace-palette] .crm-content .care-legend i:last-of-type{background:color-mix(in srgb,var(--ui-accent) 35%,var(--ui-soft))!important}

 /* These form groups live in native dialogs outside .crm-content. */
 html[data-workspace-palette] dialog :is(.modal-wrap,.modal-body,.industry-dialog-body,.dialog-body){background:var(--ui-surface)!important;color:var(--ui-ink)!important}
 html[data-workspace-palette] dialog :is(.dialog-head,.industry-dialog-head,.rs-dialog-head,.modal-head){background:transparent!important;border-color:var(--ui-line)!important;gap:16px!important;align-items:start!important}
 html[data-workspace-palette] dialog :is(.dialog-head,.industry-dialog-head,.rs-dialog-head,.modal-head) h2{margin:0!important}
 html[data-workspace-palette] dialog :is(.form-grid,.form-stack,.campus-form,.care-form,.ops-form-grid){gap:20px!important}
 html[data-workspace-palette] dialog :is(.form-grid,.form-stack,.campus-form,.care-form,.ops-form-grid) label{display:grid;gap:8px;min-width:0}
 html[data-workspace-palette] dialog :is(.form-grid,.form-stack,.campus-form,.care-form,.ops-form-grid) label:has(input[type=checkbox]){display:flex;align-items:start}
 html[data-workspace-palette] dialog :is(.form-buttons,.form-actions,.industry-dialog-actions){padding-top:18px!important;border-top:1px solid var(--ui-line)!important;gap:10px!important}
 html[data-workspace-palette] dialog .form-buttons .btn{min-width:112px}
 @media(max-width:700px){
  html[data-workspace-palette] .crm-shell[data-owner-product]:not(.suite-native-shell) .crm-content :is(.page-heading,.page-head,.page-header,.vcrm-heading,.rs-heading,.auto-heading,.heading,.edu-heading,.mfg-feature-heading):has(h1):not(:where(.owner-overview *,.ops-pearl-overview *,.company-performance *,.re-finance-workspace *,.care-hero-grid *)){padding:20px!important}
  html[data-workspace-palette] .crm-content :is(.reservation-card,.booking-card,.shift-card,.rs-order){padding:18px!important}
  html[data-workspace-palette] .crm-content :is(.hotel-details,.shift-meta,.booking-meta){gap:10px!important}
  html[data-workspace-palette] .crm-content :is(.diagnostics-filters,.wa-operations-filter,.wa-roster-selector){padding:14px!important}
  html[data-workspace-palette] #mfg-quality-inspections :is([data-inspection-plan],[data-inspection-measurement]){grid-template-columns:minmax(0,1fr)!important}
  html[data-workspace-palette] #mfg-quality-inspections [data-parameter]{grid-template-columns:repeat(2,minmax(0,1fr))!important}
 }
}
