/* Keep the risk score inside the existing risk panel, beneath its legend. */
@layer desktop-button-standard {
  html body #dashboard-section#dashboard-section#dashboard-section#dashboard-section .dashboard-risk {
    grid-template-rows:auto minmax(160px,1fr) auto auto !important;
  }
  html body #dashboard-section#dashboard-section#dashboard-section#dashboard-section .dashboard-risk-score {
    --score-surface:#102832; --score-line:#2a4652; --score-text:#e7edf2; --score-muted:#abc0ce; --score-track:#263b45; --score-fill:#53b69a;
    position:relative !important; display:grid !important; grid-template-columns:28px minmax(0,1fr) !important; gap:10px !important;
    box-sizing:border-box !important; min-width:0 !important; width:100% !important; margin:12px 0 0 !important; padding:12px !important;
    border:1px solid var(--score-line) !important; border-radius:12px !important; background:var(--score-surface) !important; color:var(--score-text) !important;
    font-family:Inter,system-ui,-apple-system,"Segoe UI",sans-serif !important; text-align:left !important; box-shadow:none !important;
  }
  html[data-appearance="light"] body #dashboard-section#dashboard-section#dashboard-section#dashboard-section .dashboard-risk-score {
    --score-surface:#f5fafc; --score-line:#dce9f3; --score-text:#173353; --score-muted:#627f9d; --score-track:#e1ebf2; --score-fill:#178871;
  }
  html[data-appearance="black"] body #dashboard-section#dashboard-section#dashboard-section#dashboard-section .dashboard-risk-score {
    --score-surface:#191919; --score-line:#383838; --score-text:#e6e6e6; --score-muted:#b5b5b5; --score-track:#333; --score-fill:#58a88c;
  }
  html[data-theme="warm-oak"] body #dashboard-section#dashboard-section#dashboard-section#dashboard-section .dashboard-risk-score {
    --score-surface:#f7f1e7; --score-line:#dfd0bc; --score-text:#493323; --score-muted:#66594d; --score-track:#e9dfd0; --score-fill:#398366;
  }
  html body #dashboard-section .dashboard-risk-score .risk-score-leaf {
    display:block !important; width:28px !important; height:28px !important; color:var(--score-fill) !important; fill:currentColor !important;
  }
  html body #dashboard-section .dashboard-risk-score .risk-score-content { min-width:0 !important; }
  html body #dashboard-section .dashboard-risk-score .risk-score-heading {
    display:flex !important; align-items:center !important; justify-content:space-between !important; gap:8px !important; color:var(--score-text) !important;
  }
  html body #dashboard-section .dashboard-risk-score .risk-score-title { display:inline-flex !important; align-items:center !important; gap:6px !important; min-width:0 !important; font-size:13px !important; line-height:19px !important; color:var(--score-text) !important; }
  html body #dashboard-section .dashboard-risk-score .risk-score-title > span { color:inherit !important; }
  html body #dashboard-section .dashboard-risk-score .risk-score-info {
    display:inline-grid !important; place-items:center !important; flex:0 0 16px !important; width:16px !important; height:16px !important; min-height:0 !important; padding:0 !important;
    border:1px solid var(--score-muted) !important; border-radius:50% !important; background:transparent !important; color:var(--score-muted) !important; font:700 11px/1 Georgia,serif !important; cursor:pointer !important; box-shadow:none !important;
  }
  html body #dashboard-section .dashboard-risk-score .risk-score-value { flex:0 0 auto !important; white-space:nowrap !important; font-size:17px !important; line-height:22px !important; color:var(--score-text) !important; font-weight:650 !important; }
  html body #dashboard-section .dashboard-risk-score [data-risk-score-value] { color:var(--score-fill) !important; font-weight:800 !important; }
  html body #dashboard-section .dashboard-risk-score .risk-score-track { position:relative !important; height:8px !important; margin:11px 0 8px !important; border-radius:4px !important; overflow:hidden !important; background:var(--score-track) !important; }
  /* Anchor colors to the full risk scale; reveal only the current score. */
  html body #dashboard-section .dashboard-risk-score .risk-score-fill { display:block !important; height:100% !important; width:100% !important; background:linear-gradient(90deg,#43A66F 0%,#8FBC45 25%,#E6C53C 50%,#E89435 75%,#D54C45 100%) !important; clip-path:inset(0 calc(100% - var(--risk-score-progress,0%)) 0 0 round 4px) !important; border-radius:4px !important; }
  html body #dashboard-section .dashboard-risk-score .risk-score-track::after { content:"" !important; position:absolute !important; inset:0 !important; background:repeating-linear-gradient(90deg,transparent 0,transparent calc(16.6667% - 2px),var(--score-surface) calc(16.6667% - 2px),var(--score-surface) 16.6667%) !important; }
  html body #dashboard-section .dashboard-risk-score .risk-score-scale { display:flex !important; justify-content:space-between !important; gap:8px !important; font-size:11px !important; line-height:16px !important; color:var(--score-muted) !important; }
  html body #dashboard-section .dashboard-risk-score .risk-score-scale span { color:inherit !important; }
  html body #dashboard-section .dashboard-risk-score .risk-score-help:not([hidden]) { position:absolute !important; bottom:calc(100% + 6px) !important; inset-inline:0 !important; z-index:20 !important; margin:0 !important; padding:12px !important; background:var(--score-surface) !important; border:1px solid var(--score-line) !important; border-radius:9px !important; color:var(--score-text) !important; font-size:12px !important; line-height:1.5 !important; box-shadow:0 5px 18px #0002 !important; }
  html body #dashboard-section .dashboard-risk-score .risk-score-help[hidden] { display:none !important; }

  /* Keep the score in the panel footer in both views. In line mode the history
     plot is absolutely positioned, so reserve its bottom edge for the score. */
  html body #dashboard-section#dashboard-section#dashboard-section#dashboard-section .dashboard-risk.is-line .dashboard-risk-score {
    position:absolute !important; display:grid !important; inset:auto 18px 12px !important; width:auto !important; margin:0 !important;
  }
  html body #dashboard-section#dashboard-section#dashboard-section#dashboard-section .dashboard-risk.is-line .dashboard-risk-history {
    bottom:122px !important;
  }
}

@media (max-width:760px) {
  @layer desktop-button-standard {
    html body #dashboard-section#dashboard-section#dashboard-section#dashboard-section .dashboard-risk.is-line .dashboard-risk-score {
      inset-inline:16px !important; bottom:12px !important;
    }
    html body #dashboard-section#dashboard-section#dashboard-section#dashboard-section .dashboard-risk.is-line .dashboard-risk-history {
      bottom:122px !important;
    }
  }
}
