/* Application appearance contract, R48.
 * Finite, audited palettes. No layout changes, transforms or blanket recolouring
 * of status/error/warning cells. Loaded after the existing presentation layers.
 * KPI selectors below are the real card families audited across all role pages.
 */
[data-hms-theme] {
  --theme-canvas: #f7f4ee;
  --theme-soft: #fffaf0;
  --theme-tint: #f7edda;
  --theme-selected: #ecd5a9;
  --theme-edge: #d8bf91;
  --theme-accent: #a46b20;
  --theme-ink: #5c3c17;
  --theme-muted: #6b6459;
  --theme-line: #e4dcd0;
  --theme-table: #f5e8cf;
  --theme-stripe: #fcfaf6;
  --theme-count-bg: #e8e5f5;
  --theme-count-ink: #524278;
  --kpi-blue-bg: #eef5fd; --kpi-blue-edge: #6194c7;
  --kpi-teal-bg: #edf8f4; --kpi-teal-edge: #4a9b80;
  --kpi-violet-bg: #f3effb; --kpi-violet-edge: #9980bd;
  --kpi-amber-bg: #fff6e6; --kpi-amber-edge: #c59742;
  --kpi-slate-bg: #f0f4f8; --kpi-slate-edge: #8a9db5;
  --kpi-rose-bg: #fff0f2; --kpi-rose-edge: #c77683;
}
[data-hms-theme="ocean"] {
  --theme-canvas: #eff4f9; --theme-soft: #f3f8ff; --theme-tint: #eaf2fc;
  --theme-selected: #c8def2; --theme-edge: #9fbfdc; --theme-accent: #286393;
  --theme-ink: #234f74; --theme-muted: #586b7e; --theme-line: #d6e1ec;
  --theme-table: #e0edfa; --theme-stripe: #f7faff;
  --theme-count-bg: #e6edf8; --theme-count-ink: #385d91;
  --kpi-blue-bg: #eaf3fd; --kpi-teal-bg: #eaf7f5; --kpi-violet-bg: #f0effb;
}
[data-hms-theme="forest"] {
  --theme-canvas: #eff5f1; --theme-soft: #f3faf6; --theme-tint: #e8f3ec;
  --theme-selected: #c8e3d4; --theme-edge: #9dc5b0; --theme-accent: #2a785e;
  --theme-ink: #225a48; --theme-muted: #586f62; --theme-line: #d6e4db;
  --theme-table: #deeee4; --theme-stripe: #f7fbf8;
  --theme-count-bg: #e1eef0; --theme-count-ink: #356372;
  --kpi-blue-bg: #eef5fb; --kpi-teal-bg: #e8f6ee; --kpi-violet-bg: #f1f0f9;
}
[data-hms-theme="plum"] {
  --theme-canvas: #f5f1f8; --theme-soft: #faf6fd; --theme-tint: #f0e9f7;
  --theme-selected: #ddcceb; --theme-edge: #bea5d2; --theme-accent: #80539b;
  --theme-ink: #624275; --theme-muted: #71607b; --theme-line: #e1d8e9;
  --theme-table: #eee3f6; --theme-stripe: #fcf9ff;
  --theme-count-bg: #eee5f6; --theme-count-ink: #724889;
  --kpi-blue-bg: #eff3fd; --kpi-teal-bg: #eef8f5; --kpi-violet-bg: #f0eaf9;
}

/* Additional palettes share the same layout and semantic status colours. */
[data-hms-theme="pearl"] {
  --theme-canvas: #f3f5f7;
  --theme-soft: #fafcfd;
  --theme-tint: #eef3f6;
  --theme-selected: #dae5ec;
  --theme-edge: #b8c9d5;
  --theme-accent: #49677e;
  --theme-ink: #2f4c62;
  --theme-muted: #596975;
  --theme-line: #dce3e9;
  --theme-table: #e9eff4;
  --theme-stripe: #fafcfe;
  --theme-count-bg: #eef3f6; --theme-count-ink: #2f4c62;
}
[data-hms-theme="slate"] {
  --theme-canvas: #f1f3f5;
  --theme-soft: #f8fafb;
  --theme-tint: #e9edf1;
  --theme-selected: #cfd7df;
  --theme-edge: #acbac7;
  --theme-accent: #47596c;
  --theme-ink: #293a4e;
  --theme-muted: #596674;
  --theme-line: #d6dfe7;
  --theme-table: #e2e8ef;
  --theme-stripe: #f7f9fc;
  --theme-count-bg: #e9edf1; --theme-count-ink: #293a4e;
}
[data-hms-theme="rose"] {
  --theme-canvas: #faf2f5;
  --theme-soft: #fff8fa;
  --theme-tint: #f9e9ef;
  --theme-selected: #efd0dc;
  --theme-edge: #d8aabc;
  --theme-accent: #9c476b;
  --theme-ink: #71304d;
  --theme-muted: #785b69;
  --theme-line: #ead9e1;
  --theme-table: #f5e0e9;
  --theme-stripe: #fff9fb;
  --theme-count-bg: #f9e9ef; --theme-count-ink: #71304d;
}
[data-hms-theme="copper"] {
  --theme-canvas: #f8f1ed;
  --theme-soft: #fff8f3;
  --theme-tint: #f8e9de;
  --theme-selected: #ebcebb;
  --theme-edge: #cfaa91;
  --theme-accent: #9b5433;
  --theme-ink: #6e3821;
  --theme-muted: #786054;
  --theme-line: #e7d8cc;
  --theme-table: #f1e0d1;
  --theme-stripe: #fdf9f6;
  --theme-count-bg: #f8e9de; --theme-count-ink: #6e3821;
}
[data-hms-theme="indigo"] {
  --theme-canvas: #f1f2fa;
  --theme-soft: #f7f8ff;
  --theme-tint: #e9ecfc;
  --theme-selected: #cfd6f4;
  --theme-edge: #abb7de;
  --theme-accent: #4d5c9e;
  --theme-ink: #354174;
  --theme-muted: #616781;
  --theme-line: #dadeee;
  --theme-table: #e1e5f8;
  --theme-stripe: #f9faff;
  --theme-count-bg: #e9ecfc; --theme-count-ink: #354174;
}
[data-hms-theme="lagoon"] {
  --theme-canvas: #edf6f7;
  --theme-soft: #f2fbfc;
  --theme-tint: #dff3f5;
  --theme-selected: #bce3e8;
  --theme-edge: #8bbfc7;
  --theme-accent: #247b86;
  --theme-ink: #195b65;
  --theme-muted: #506e74;
  --theme-line: #d0e4e7;
  --theme-table: #d9eff2;
  --theme-stripe: #f6fcfd;
  --theme-count-bg: #dff3f5; --theme-count-ink: #195b65;
}

@media screen {
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] {
    --hms-canvas: var(--theme-canvas); --hms-canvas-soft: var(--theme-soft);
    --hms-surface-soft: var(--theme-soft); --hms-surface-warm: var(--theme-soft);
    --hms-primary: var(--theme-accent); --hms-primary-strong: var(--theme-accent);
    --hms-primary-dark: var(--theme-ink); --hms-primary-soft: var(--theme-soft);
    --hms-primary-hover: var(--theme-tint); --hms-primary-border: var(--theme-edge);
    --hms-border: var(--theme-line); --hms-border-strong: var(--theme-edge);
    --hms-muted: var(--theme-muted); --hms-focus: 0 0 0 3px var(--theme-tint);
    --hms-control-face: linear-gradient(180deg,#fff,var(--theme-soft));
    --hms-control-edge: var(--theme-edge); --hms-control-ink: var(--theme-ink);
    --hms-selected-face: linear-gradient(180deg,var(--theme-tint),var(--theme-selected));
    --hms-selected-ink: var(--theme-ink);
    --hms-control-depth: inset 0 1px 0 #fff,0 2px 0 var(--theme-edge),0 4px 9px #1720330b;
    --hms-control-hover-depth: inset 0 1px 0 #fff,0 2px 0 var(--theme-accent),0 6px 12px #17203312;
    --hms-table-head: linear-gradient(180deg,var(--theme-tint),var(--theme-table));
    --hms-table-head-ink: var(--theme-ink);
    --br1: var(--theme-selected); --bronze1: var(--theme-selected);
    --bl: var(--theme-line); --bm: var(--theme-edge); --bs: var(--theme-line); --bd: var(--theme-edge);
    background: linear-gradient(180deg,#fff 0%,var(--theme-canvas) 65%) !important;
  }
  body.hms-executive-ui[data-hms-theme] .shell {
    border-color: var(--theme-line) !important;
    box-shadow: 0 12px 34px #1720330b !important;
  }
  body.hms-executive-ui[data-hms-theme] .shell::before {
    background: linear-gradient(180deg,var(--theme-soft),#ffffff00 128px) !important;
  }
  body.hms-executive-ui[data-hms-theme] :is(.topbar,.rx-topbar,.subbar,.rx-subbar) {
    border-color: var(--theme-line) !important;
  }
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] .shell :is(.tab.active,.rx-tab.active,.rx-subtab.active,.phx-tab.active,.med-tabs a.active,.ds-module-tabs a[aria-current="page"],.mp-tab[aria-current="page"],.tab[aria-current="page"],.btn.primary,.phx-btn.primary,.rx-btn.primary,.ds-btn.ds-selected,.mp-button:not(.mp-button-light)) {
    border-color: var(--theme-accent) !important;
    box-shadow: inset 0 1px 0 #ffffffd9,0 2px 0 var(--theme-edge),0 4px 9px #1720330d !important;
  }
  /* The older Profile/audit action layer embeds gold gradient stops. Override
     only its explicit primary buttons; retain semantic danger/success actions. */
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] .shell :is(.btn-primary,.btn.btnPrimary,.btn.bronze,.phx-btn.phx-btn-primary,.lx-btn:not(.-ghost),.audit-btn.primary,.saveBtn,.phx-date-apply,button.primary,input[type="submit"].primary):not(.danger):not(.success):not(.soft-reject):not(.soft-approve) {
    background: var(--hms-selected-face) !important;
    color: var(--theme-ink) !important;
    border-color: var(--theme-accent) !important;
  }
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] .shell :is(.patient-toolbar,.med-filter,.ds-toolbar,.mp-toolbar,.filter-bar,.phx-filters,.rx-filters) {
    background: var(--theme-soft) !important;
  }
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="hidden"]),select,textarea):focus-visible {
    outline: 2px solid var(--theme-accent) !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 4px var(--theme-tint) !important;
  }
  body.hms-executive-ui[data-hms-theme] :is(input[type="checkbox"],input[type="radio"]) { accent-color: var(--theme-accent); }

  /* All data headers share the palette; body status fills are deliberately retained. */
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] .shell table > thead > tr > :is(th,td),
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] :is(dialog,.modal,.global-bills-dialog,.mp-dialog) table > thead > tr > th {
    background: var(--hms-table-head) !important;
    color: var(--theme-ink) !important;
    border-color: var(--theme-edge) !important;
  }
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] .shell table > thead > tr + tr > :is(th,td) { background: var(--theme-soft) !important; }
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] .shell table > tbody > tr:not([class]):not([style]):nth-child(even) > td:not([class]):not([style]) { background: var(--theme-stripe) !important; }
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] .shell table > tbody > tr:not([class]):not([style]):hover > td:not([class]):not([style]) { background: var(--theme-tint) !important; }
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] .shell :is(tr.hms-row-selected,tr.is-selected,tr.row-selected) > td { background: var(--theme-selected) !important; }

  /* Known card families. Avoid generic .metric and .summary-card: those also name
     inline text and large structural containers in purchase/billing screens. */
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] :is(.kpi,.kpiCard,.kpi-card,.phx-kpi,.patient-kpi-box,.pfr-kpi,.ba-kpi,.stock-kpi,.recent-stock-kpi,.revenue-kpi,.supplier-payment-metric,.sdp-metrics>div,.hmsRetentionKpi,.ai-amounts>div,.lx-summaryItem,.lx-visitMoneyGrid>span,.mp-day-metrics>div,.billing-dock-payment__metric,.bill-delete-metric,.patient-delete-metric,.billing-correction-review-metric,.hms-due-kpi,.ul-kpi,.drKpiMetric,.phPatientKpiMetric,.mp-stat,.refund-kpi,.refund-review-kpis>div,.metrics>.metric,.attendance-paid-total,[data-kpi-tone]) {
    --kpi-bg: var(--kpi-blue-bg); --kpi-edge: var(--kpi-blue-edge);
    background: linear-gradient(120deg,var(--kpi-bg),#ffffff 160%) !important;
    border-color: var(--theme-line) !important;
    border-left: 3px solid var(--kpi-edge) !important;
    color: #233247 !important;
    box-shadow: inset 0 1px 0 #ffffffd9,0 3px 9px #17203308 !important;
    transform: none !important;
  }
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] :is(.kpi,.kpiCard,.kpi-card,.phx-kpi,.patient-kpi-box,.pfr-kpi,.ba-kpi,.stock-kpi,.recent-stock-kpi,.revenue-kpi,.supplier-payment-metric,.sdp-metrics>div,.hmsRetentionKpi,.ai-amounts>div,.lx-summaryItem,.lx-visitMoneyGrid>span,.mp-day-metrics>div,.billing-dock-payment__metric,.bill-delete-metric,.patient-delete-metric,.billing-correction-review-metric,.hms-due-kpi,.ul-kpi,.drKpiMetric,.phPatientKpiMetric,.mp-stat,.refund-kpi,.refund-review-kpis>div,.metrics>.metric):nth-child(6n+2) { --kpi-bg: var(--kpi-teal-bg); --kpi-edge: var(--kpi-teal-edge); }
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] :is(.kpi,.kpiCard,.kpi-card,.phx-kpi,.patient-kpi-box,.pfr-kpi,.ba-kpi,.stock-kpi,.recent-stock-kpi,.revenue-kpi,.supplier-payment-metric,.sdp-metrics>div,.hmsRetentionKpi,.ai-amounts>div,.lx-summaryItem,.lx-visitMoneyGrid>span,.mp-day-metrics>div,.billing-dock-payment__metric,.bill-delete-metric,.patient-delete-metric,.billing-correction-review-metric,.hms-due-kpi,.ul-kpi,.drKpiMetric,.phPatientKpiMetric,.mp-stat,.refund-kpi,.refund-review-kpis>div,.metrics>.metric):nth-child(6n+3) { --kpi-bg: var(--kpi-violet-bg); --kpi-edge: var(--kpi-violet-edge); }
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] :is(.kpi,.kpiCard,.kpi-card,.phx-kpi,.patient-kpi-box,.pfr-kpi,.ba-kpi,.stock-kpi,.recent-stock-kpi,.revenue-kpi,.supplier-payment-metric,.sdp-metrics>div,.hmsRetentionKpi,.ai-amounts>div,.lx-summaryItem,.lx-visitMoneyGrid>span,.mp-day-metrics>div,.billing-dock-payment__metric,.bill-delete-metric,.patient-delete-metric,.billing-correction-review-metric,.hms-due-kpi,.ul-kpi,.drKpiMetric,.phPatientKpiMetric,.mp-stat,.refund-kpi,.refund-review-kpis>div,.metrics>.metric):nth-child(6n+4) { --kpi-bg: var(--kpi-amber-bg); --kpi-edge: var(--kpi-amber-edge); }
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] :is(.kpi,.kpiCard,.kpi-card,.phx-kpi,.patient-kpi-box,.pfr-kpi,.ba-kpi,.stock-kpi,.recent-stock-kpi,.revenue-kpi,.supplier-payment-metric,.sdp-metrics>div,.hmsRetentionKpi,.ai-amounts>div,.lx-summaryItem,.lx-visitMoneyGrid>span,.mp-day-metrics>div,.billing-dock-payment__metric,.bill-delete-metric,.patient-delete-metric,.billing-correction-review-metric,.hms-due-kpi,.ul-kpi,.drKpiMetric,.phPatientKpiMetric,.mp-stat,.refund-kpi,.refund-review-kpis>div,.metrics>.metric):nth-child(6n+5) { --kpi-bg: var(--kpi-slate-bg); --kpi-edge: var(--kpi-slate-edge); }
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] :is(.kpi,.kpiCard,.kpi-card,.phx-kpi,.patient-kpi-box,.pfr-kpi,.ba-kpi,.stock-kpi,.recent-stock-kpi,.revenue-kpi,.supplier-payment-metric,.sdp-metrics>div,.hmsRetentionKpi,.ai-amounts>div,.lx-summaryItem,.lx-visitMoneyGrid>span,.mp-day-metrics>div,.billing-dock-payment__metric,.bill-delete-metric,.patient-delete-metric,.billing-correction-review-metric,.hms-due-kpi,.ul-kpi,.drKpiMetric,.phPatientKpiMetric,.mp-stat,.refund-kpi,.refund-review-kpis>div,.metrics>.metric):nth-child(6n) { --kpi-bg: var(--kpi-rose-bg); --kpi-edge: var(--kpi-rose-edge); }
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] :is(.kpi,.kpiCard,.phx-kpi,.patient-kpi-box)::after { background: transparent !important; }
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] :is(.kpi,.kpiCard,.phx-kpi,.patient-kpi-box)::before { background: var(--kpi-edge) !important; }
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] :is([data-kpi-tone="blue"],.kpiBlue) { --kpi-bg: var(--kpi-blue-bg) !important; --kpi-edge: var(--kpi-blue-edge) !important; }
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] :is([data-kpi-tone="teal"],.kpiGreen,.attendance-paid-total,.lx-summaryItem.is-paid,.lx-summaryItem.is-clear) { --kpi-bg: var(--kpi-teal-bg) !important; --kpi-edge: var(--kpi-teal-edge) !important; }
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] :is([data-kpi-tone="violet"],.lx-summaryItem.is-complaint,.refund-kpi.refund-due) { --kpi-bg: var(--kpi-violet-bg) !important; --kpi-edge: var(--kpi-violet-edge) !important; }
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] :is([data-kpi-tone="amber"],.kpiOrange,.refund-kpi.refund-out) { --kpi-bg: var(--kpi-amber-bg) !important; --kpi-edge: var(--kpi-amber-edge) !important; }
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] [data-kpi-tone="slate"] { --kpi-bg: var(--kpi-slate-bg) !important; --kpi-edge: var(--kpi-slate-edge) !important; }
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] :is([data-kpi-tone="rose"],.kpiRed,.hms-due-kpi.is-danger,.lx-summaryItem.is-due,.lx-visitMoneyGrid>span.is-due) { --kpi-bg: var(--kpi-rose-bg) !important; --kpi-edge: var(--kpi-rose-edge) !important; }
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] :is(.kpi,.kpiCard,.kpi-card,.phx-kpi,.patient-kpi-box,.pfr-kpi,.ba-kpi,.stock-kpi,.recent-stock-kpi,.revenue-kpi,.supplier-payment-metric,.sdp-metrics>div,.hmsRetentionKpi,.ai-amounts>div,.lx-summaryItem,.lx-visitMoneyGrid>span,.mp-day-metrics>div,.billing-dock-payment__metric,.bill-delete-metric,.patient-delete-metric,.billing-correction-review-metric,.hms-due-kpi,.ul-kpi,.drKpiMetric,.phPatientKpiMetric,.mp-stat,.refund-kpi,.refund-review-kpis>div,.metrics>.metric) :is(.k,.kpiLabel,.small,.meta,.kpiSub) { color: #526176 !important; }

  /* Legacy dashboard keys share the same meaning across Doctor, Pharmacy and Admin. */
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] :is([data-billing-kpi-state="patients"],[data-dr-kpi-state="patients"],[data-ph-kpi-state="patients"]) { --kpi-bg: var(--kpi-blue-bg) !important; --kpi-edge: var(--kpi-blue-edge) !important; }
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] :is([data-billing-kpi-state="patients_new"],[data-dr-kpi-state="patients_new"],[data-ph-kpi-state="patients_new"],[data-billing-kpi-state="billed"],[data-dr-kpi-state="billed"],[data-ph-kpi-state="billed"]) { --kpi-bg: var(--kpi-teal-bg) !important; --kpi-edge: var(--kpi-teal-edge) !important; }
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] :is([data-billing-kpi-state="patients_review"],[data-dr-kpi-state="patients_review"],[data-ph-kpi-state="patients_review"]) { --kpi-bg: var(--kpi-violet-bg) !important; --kpi-edge: var(--kpi-violet-edge) !important; }
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] :is([data-billing-kpi-state="waiting"],[data-dr-kpi-state="waiting"],[data-ph-kpi-state="waiting"],[data-billing-kpi-state="not_billed"],[data-dr-kpi-state="not_billed"],[data-ph-kpi-state="not_billed"]) { --kpi-bg: var(--kpi-amber-bg) !important; --kpi-edge: var(--kpi-amber-edge) !important; }
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] :is([data-billing-kpi-state="draft"],[data-dr-kpi-state="draft"],[data-ph-kpi-state="draft"]) { --kpi-bg: var(--kpi-slate-bg) !important; --kpi-edge: var(--kpi-slate-edge) !important; }
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] .metrics > .metric:first-child { --kpi-bg: var(--kpi-rose-bg) !important; --kpi-edge: var(--kpi-rose-edge) !important; }
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] .metrics > .metric:nth-child(2) { --kpi-bg: var(--kpi-amber-bg) !important; --kpi-edge: var(--kpi-amber-edge) !important; }

  /* Approval counts indicate work to review, not a clinical or payment error. */
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] .hms-approval-count,
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] .shell .tabs .tab .hms-approval-count,
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] .ai-count,
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] .global-shell-notify-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 21px; min-height: 21px; padding: 2px 6px;
    background: var(--theme-count-bg) !important;
    color: var(--theme-count-ink) !important;
    border: 1px solid var(--theme-edge); border-radius: 999px;
    font-size: 11px; font-weight: 750; line-height: 1.2;
  }

  /* Distinct, restrained header actions; dimensions and order belong to shell. */
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] .global-shell-home { background: #edf4fd !important; color: #285680 !important; border-color: #b7cde5 !important; }
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] .global-shell-search .search-input { background: #f8fafc !important; border-color: #c9d4e1 !important; color: #24354b !important; }
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] .hms-recent-screen { background: #fff7e9 !important; color: #805c25 !important; border-color: #dfc59a !important; }
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] .global-shell-notify-btn { background: #f3eefb !important; color: #715098 !important; border-color: #cdbbdf !important; }
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] [data-hms-notify-compose] { background: #ecf7f4 !important; color: #296d5b !important; border-color: #abd2c3 !important; }
  body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] .global-shell-action.logout { background: #fff3f3 !important; color: #94505b !important; border-color: #e0bec5 !important; }
}

/* Admin appearance picker and isolated live sample; preview never changes saved values. */
.appearance-settings { max-width: 1100px; }
.appearance-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.appearance-heading h3 { margin: 0 0 5px; }
.appearance-heading p { margin: 0; color: #526176; font-size: 12px; }
.appearance-current { background: var(--theme-tint); color: var(--theme-ink); padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.appearance-choices { border: 0; padding: 0; margin: 16px 0; display: grid; grid-template-columns: repeat(auto-fit,minmax(190px,1fr)); gap: 10px; }
.appearance-choices legend { margin-bottom: 8px; font-size: 12px; font-weight: 750; }
.appearance-choice { position: relative; display: flex; flex-wrap: wrap; align-items: start; gap: 8px; border: 1px solid var(--theme-edge); border-radius: 12px; padding: 11px; background: var(--theme-soft); cursor: pointer; }
.appearance-choice:has(input:checked) { outline: 2px solid var(--theme-accent); outline-offset: 2px; }
.appearance-choice input { flex: 0 0 auto; margin-top: 3px; }
.appearance-choice-copy { min-width: 0; flex: 1; }
.appearance-choice-copy strong { display: block; color: var(--theme-ink); font-size: 13px; }
.appearance-choice-copy small { display: block; margin-top: 4px; line-height: 1.4; color: #536174; font-size: 11px; }
.appearance-swatches { display: flex; gap: 4px; width: 100%; padding-left: 24px; }
.appearance-swatches i { height: 14px; width: 25px; border-radius: 4px; background: var(--theme-accent); }
.appearance-swatches i:nth-child(2) { background: var(--theme-selected); }
.appearance-swatches i:nth-child(3) { background: var(--theme-table); border: 1px solid var(--theme-edge); }
.appearance-preview { border: 1px solid var(--theme-edge); padding: 12px; border-radius: 12px; background: var(--theme-canvas); }
.appearance-preview-heading { display: flex; gap: 12px; align-items: center; justify-content: space-between; color: var(--theme-ink); font-size: 12px; }
.appearance-preview-kpis { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; margin: 10px 0; }
.appearance-preview-kpis > div { padding: 10px; border-radius: 9px; }
.appearance-preview-kpis small { display: block; color: #526176; font-size: 11px; }
.appearance-preview-kpis strong { display: block; margin-top: 4px; font-size: 19px; }
.appearance-preview-table { width: 100%; border-collapse: collapse; background: #fff; }
.appearance-preview-table :is(th,td) { text-align: left; padding: 7px 9px; font-size: 12px; border-bottom: 1px solid var(--theme-line); }
body.hms-executive-ui.hms-ui-density-compact[data-hms-theme] .shell .appearance-preview-table thead th { background: var(--theme-table) !important; }
.appearance-save { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.appearance-save small { max-width: 500px; color: #526176; font-size: 12px; }
.appearance-error { color: #a52938; background: #fff0f2; border: 1px solid #e0b8bf; padding: 9px 12px; border-radius: 9px; }
@media (max-width: 900px) { .appearance-choices { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 500px) { .appearance-choices { grid-template-columns: 1fr; } .appearance-preview-kpis { grid-template-columns: repeat(2,minmax(0,1fr)); } }
