/* THRS Dashboard Dark V4 — Final Premium Polish
   In-place origin/main visual-only release. Live CSS, no app logic/data changes.
   Existing layout architecture, RTL, light theme, and status semantics retained. */

/* Readability across header and data-source controls. */
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 {
  --v7-muted: #c6d7ea;
  --v6-muted: #c8d8ea;
  --thrs-v4-shadow: 0 17px 42px rgba(0,8,25,.25),inset 0 1px 0 rgba(246,251,255,.065);
  --thrs-v4-gold: #f2d58d;
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 :is(
  .thrs-main-dashboard__date,
  .thrs-main-dashboard__v7-briefing-copy > span,
  .thrs-main-dashboard__v6-section-intro > div:first-child > span,
  .thrs-main-dashboard__v6-decision-heading > span
) {
  font-size:10.5px;
  font-weight:850;
  letter-spacing:.095em;
  color:#f2d58d!important;
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 :is(
  .thrs-main-dashboard__page-heading > p:last-child,
  .thrs-main-dashboard__v7-briefing-copy > p,
  .thrs-main-dashboard__v6-decision-heading p
) {
  color:#cbd9e9!important;
  font-size:12px;
  line-height:1.66;
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 :is(
  .thrs-main-dashboard__v7-1-source small,
  .thrs-main-dashboard__v7-1-coverage span,
  .thrs-main-dashboard__v7-1-coverage small,
  .thrs-main-dashboard__v7-health-copy small
) {
  color:#c6d8ed!important;
  font-size:10px;
  line-height:1.5;
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__v7-1-source strong {
  color:#f2f8ff!important;
  font-size:11px;
}

/* Sidebar: lift section-label contrast, calm the decorative pattern, retain locations. */
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-sidebar::after {
  opacity:.075!important;
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-sidebar-section-label {
  font-size:10.5px!important;
  font-weight:850!important;
  letter-spacing:.075em;
  color:#cbdcec!important;
  opacity:1!important;
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-sidebar-link {
  font-weight:560;
  color:#e3edf8!important;
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-sidebar-link:hover:not(.sidebar-active-link) {
  background:rgba(81,140,191,.18)!important;
  border-color:rgba(162,199,230,.21)!important;
  box-shadow:inset 0 1px 0 rgba(245,251,255,.045);
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-sidebar-link:focus-visible {
  outline:2px solid #f2d58d!important;
  outline-offset:2px;
}

/* Executive command: number/label contrast and meaningful visual priorities. */
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__v6-command-deck {
  box-shadow:0 20px 45px rgba(0,9,27,.31),0 0 26px rgba(232,183,94,.085),inset 0 1px 0 rgba(245,252,255,.075)!important;
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__v3-primary-kpi :is(small,span) {
  font-size:11px;
  color:#e5eefa!important;
  line-height:1.5;
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__v3-primary-kpi small {
  color:#f6d998!important;
  font-weight:780;
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__v3-primary-icon {
  background:linear-gradient(148deg,rgba(92,149,204,.25),rgba(23,61,108,.44))!important;
  border:1px solid rgba(154,205,250,.32)!important;
  box-shadow:inset 0 1px 0 rgba(244,251,255,.12),0 9px 22px rgba(0,16,36,.20);
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__v3-attention-head strong {
  text-shadow:0 4px 18px rgba(0,8,23,.28);
}

/* KPI tiles: icon contrast, hover/focus elevation without translating elements. */
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__v6-signal-rail .thrs-main-dashboard__stat-card {
  border-color:rgba(151,193,235,.33)!important;
  transition:box-shadow .18s ease,border-color .18s ease,background-color .18s ease;
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__v6-signal-rail .thrs-main-dashboard__stat-card:hover,
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__v6-signal-rail .thrs-main-dashboard__stat-card:focus-within {
  border-color:rgba(237,199,118,.64)!important;
  box-shadow:0 16px 32px rgba(0,9,27,.29),inset 0 1px 0 rgba(252,250,237,.12),0 0 17px rgba(224,184,106,.11)!important;
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__v6-signal-rail .thrs-main-dashboard__stat-icon {
  background:rgba(85,153,219,.20)!important;
  border:1px solid rgba(137,193,241,.35);
  box-shadow:inset 0 1px 0 rgba(244,252,255,.14),0 7px 18px rgba(1,18,41,.19);
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__v6-signal-rail .thrs-main-dashboard__stat-icon svg {
  color:#dbeaff;
  stroke-width:2.15;
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__stat-title {
  color:#e7f0fa!important;
  font-size:11.5px!important;
  line-height:1.38;
  font-weight:750;
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__stat-subtitle {
  color:#c4d5e7!important;
  font-size:10.5px!important;
  line-height:1.45;
}

/* Analytics: preserve Chart.js values, lift canvas contrast and make labels readable. */
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__v6-intelligence {
  border-color:rgba(229,194,123,.56)!important;
  box-shadow:var(--thrs-v4-shadow),0 0 14px rgba(223,177,90,.07)!important;
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__v6-intelligence-canvas > .thrs-main-dashboard__panel {
  background:linear-gradient(135deg,rgba(18,49,79,.53),rgba(8,32,61,.77))!important;
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__chart-wrap canvas {
  filter:brightness(1.09) saturate(1.14) contrast(1.035);
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__department-chart canvas {
  filter:brightness(1.10) saturate(1.09);
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 :is(
  .thrs-main-dashboard__panel-header h2,
  .thrs-main-dashboard__v6-section-intro h2
) {
  color:#f7faff!important;
  text-shadow:0 1px 11px rgba(3,17,37,.22);
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__department-row {
  font-size:11.25px!important;
  color:#c9daea;
  line-height:1.35;
  border-radius:8px;
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__department-name span {
  color:#e3effc!important;
  font-weight:690;
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__department-row :is(strong,small) {
  color:#cdddfe!important;
  font-size:10.5px!important;
  font-variant-numeric:tabular-nums;
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__department-row:is(:hover,.is-selected,:focus-visible) {
  background:rgba(83,141,196,.16)!important;
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__v7-range-switch button {
  color:#d8e7fa;
  border-color:rgba(162,205,245,.24);
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__v7-range-switch button.is-active {
  color:#ffebb9!important;
  background:rgba(232,188,91,.18)!important;
  border-color:rgba(233,196,114,.68)!important;
}

/* Decision queue: tighter typography and warm critical signals. */
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__v6-decision-summary > div {
  border-color:rgba(152,196,238,.30)!important;
  box-shadow:inset 0 1px 0 rgba(250,253,255,.075);
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__v6-decision-summary small {
  color:#d0e0f0!important;
  font-size:10px!important;
  line-height:1.42;
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 :is(
  .thrs-main-dashboard__approval-copy small,
  .thrs-main-dashboard__quick-copy small
) {
  color:#c9dbea!important;
  font-size:10.5px!important;
  line-height:1.45;
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 :is(
  .thrs-main-dashboard__approval-copy strong,
  .thrs-main-dashboard__quick-copy strong
) {
  color:#f1f7ff!important;
  font-size:11.5px!important;
  line-height:1.45;
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__v7-decision-tools button {
  color:#e4effc!important;
  border-color:rgba(162,203,244,.31)!important;
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__approval-item:hover,
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__quick-action:hover {
  background:rgba(62,118,168,.24)!important;
  border-color:rgba(240,195,111,.51)!important;
}

/* Business Pulse: three quiet tonal treatments for three equivalent error cards.
   These are decorative only — no fabricated health data or provider status. */
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__v6-business-grid > .thrs-main-dashboard__integration-widget:nth-child(1) .thrs-integration-widget__unavailable {
  background:linear-gradient(140deg,#163e57,#102e4b)!important;
  border-color:rgba(100,198,203,.35)!important;
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__v6-business-grid > .thrs-main-dashboard__integration-widget:nth-child(2) .thrs-integration-widget__unavailable {
  background:linear-gradient(140deg,#1a3a66,#102d52)!important;
  border-color:rgba(115,179,239,.37)!important;
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__v6-business-grid > .thrs-main-dashboard__integration-widget:nth-child(3) .thrs-integration-widget__unavailable {
  background:linear-gradient(140deg,#25395e,#172c50)!important;
  border-color:rgba(159,155,237,.38)!important;
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-integration-widget__unavailable :is(strong,p,small) {
  color:#dce9f9!important;
  line-height:1.6;
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-integration-widget__unavailable strong {
  color:#f6faff!important;
  font-size:12px!important;
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-integration-widget__unavailable button {
  color:#f9fcff!important;
  background:linear-gradient(135deg,#2675b3,#165284)!important;
  border-color:rgba(157,209,252,.48)!important;
  box-shadow:0 7px 17px rgba(3,15,39,.26),inset 0 1px 0 rgba(255,255,255,.075);
}
:is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-integration-widget__unavailable button:hover {
  background:linear-gradient(135deg,#3286c7,#1f639e)!important;
}

/* Small screens: protect chart/department columns and text wrapping. */
@media(max-width:760px) {
  :is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__department-row {
    font-size:11px!important;
  }
  :is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 .thrs-main-dashboard__v6-decision-summary small {
    font-size:10px!important;
  }
}
@media(prefers-reduced-motion:reduce) {
  :is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 :is(
    .thrs-main-dashboard__v6-signal-rail .thrs-main-dashboard__stat-card,
    .thrs-main-dashboard__approval-item,
    .thrs-main-dashboard__quick-action
  ) {transition:none!important;animation:none!important;}
}
@media(forced-colors:active) {
  :is(html[data-theme="dark"],html.dark,body.dark-mode) .thrs-shell .thrs-main-dashboard--v7 :is(button,a,input,select):focus-visible {
    outline:2px solid Highlight!important;
  }
}
