/* FoodCare Foodborne Guide v0.20.3 — focused scientific GUI fixes.
 * Scope: severity state, map parity/tables, algorithm evidence cards and
 * the Scientific Wide Table normal page-scroll layout. No scoring changes.
 */

/* Severity 1–5: the actual value is always visible. */
.fbp-severity-scale{position:relative!important}
.fbp-severity-scale>span.active{background:#173f98!important;color:#fff!important;border-color:#173f98!important;box-shadow:0 0 0 2px rgba(23,63,152,.12)!important}
.fbp-severity-scale>i{position:relative!important;overflow:visible!important}
.fbp-severity-scale>i::after{content:"";position:absolute;left:var(--severity-pct,0%);top:50%;width:10px;height:10px;border:3px solid #173f98;border-radius:50%;background:#fff;transform:translate(-50%,-50%);box-shadow:0 2px 6px rgba(23,63,152,.2)}

/* Normal scientific table: page scroll remains the only vertical owner. */
.fbp-main-results .fbp-risk-table thead th{top:auto!important}
.fbp-main-results .fbp-risk-table thead th:not(:first-child):not(:last-child){position:static!important}
.fbp-main-results .fbp-risk-table thead th:first-child{position:sticky!important;left:0!important;top:auto!important}
.fbp-main-results .fbp-risk-table thead th:last-child{position:sticky!important;right:0!important;top:auto!important;background:#eaf0f8!important;box-shadow:-7px 0 16px rgba(20,51,101,.08)}

/* Map selectors: one label, predictable five-button grid, no orphan button. */
.fbp-map-unified-metrics,.fbp-eu-map-controls{display:grid!important;grid-template-columns:repeat(5,minmax(0,1fr))!important;align-items:stretch!important}
.fbp-map-unified-metrics>.fbp-map-view-label,.fbp-eu-map-controls>.fbp-map-view-label{grid-column:1/-1!important;display:block!important;width:100%!important;margin:0 0 2px!important;white-space:normal!important}
.fbp-map-unified-metrics button,.fbp-eu-map-controls button{grid-row:auto!important;width:100%!important}
.fbp-map-unified-metrics button:nth-of-type(n),.fbp-eu-map-controls button:nth-of-type(n){grid-row:auto!important}

/* KPI cards: show the complete scientific metric label. */
.fbp-map-unified-kpis>span,.fbp-map-statbar>span{grid-template-columns:1fr!important;align-content:center!important;justify-items:start!important;height:auto!important;min-height:72px!important}
.fbp-map-unified-kpis b,.fbp-map-statbar b{display:block!important}
.fbp-map-unified-kpis small,.fbp-map-statbar small{display:block!important;width:100%!important;white-space:normal!important;overflow:visible!important;text-overflow:clip!important;overflow-wrap:normal!important;word-break:normal!important;line-height:1.15!important}

/* A single horizontal scroll owner and an always-accessible top scrollbar. */
.fbp-evidence-table-unified-wrap,.fbp-outbreak-table-wrap,.fbp-eu-table-wrap{position:relative!important;width:100%!important;max-width:100%!important;overflow-x:auto!important;overflow-y:visible!important;scrollbar-gutter:stable both-edges!important}
.fbp-evidence-scroll-top{display:none;width:100%;height:14px;margin:0 0 5px;overflow-x:auto;overflow-y:hidden;scrollbar-gutter:stable both-edges}
.fbp-evidence-scroll-top.is-scrollable{display:block}
.fbp-evidence-scroll-top>div{height:1px}
.fbp-outbreak-table-compact,.fbp-eu-table{width:100%!important;min-width:980px!important;table-layout:fixed!important}
.fbp-outbreak-table-compact th:nth-child(1),.fbp-outbreak-table-compact td:nth-child(1){width:10%!important;white-space:nowrap!important}
.fbp-outbreak-table-compact th:nth-child(2),.fbp-outbreak-table-compact td:nth-child(2){width:19%!important}
.fbp-outbreak-table-compact th:nth-child(3),.fbp-outbreak-table-compact td:nth-child(3){width:23%!important}
.fbp-outbreak-table-compact th:nth-child(4),.fbp-outbreak-table-compact td:nth-child(4){width:11%!important}
.fbp-outbreak-table-compact th:nth-child(5),.fbp-outbreak-table-compact td:nth-child(5){width:15%!important}
.fbp-outbreak-table-compact th:nth-child(6),.fbp-outbreak-table-compact td:nth-child(6){width:22%!important;min-width:220px!important}
.fbp-eu-table th:nth-child(1),.fbp-eu-table td:nth-child(1){width:10%!important}
.fbp-eu-table th:nth-child(2),.fbp-eu-table td:nth-child(2){width:12%!important;white-space:nowrap!important}
.fbp-eu-table th:nth-child(3),.fbp-eu-table td:nth-child(3){width:12%!important}
.fbp-eu-table th:nth-child(4),.fbp-eu-table td:nth-child(4){width:18%!important}
.fbp-eu-table th:nth-child(5),.fbp-eu-table td:nth-child(5){width:23%!important}
.fbp-eu-table th:nth-child(6),.fbp-eu-table td:nth-child(6){width:25%!important;min-width:240px!important}
.fbp-evidence-cell,.fbp-eu-table td:last-child{overflow-wrap:anywhere!important;word-break:normal!important}
.fbp-table-source-link,.fbp-evidence-cell>a,.fbp-eu-table td:last-child>a{display:block!important;width:max-content!important;max-width:100%!important;margin-top:6px!important;white-space:normal!important;overflow-wrap:anywhere!important}
.fbp-date-cell time{white-space:nowrap!important}
@media(min-width:901px){
  .fbp-outbreak-table-compact th:last-child,.fbp-eu-table th:last-child{position:sticky!important;right:0!important;z-index:8!important;background:#eaf0f8!important;box-shadow:-8px 0 14px rgba(20,51,101,.10)!important}
  .fbp-outbreak-table-compact td:last-child,.fbp-eu-table td:last-child{position:sticky!important;right:0!important;z-index:4!important;background:#f8fbff!important;box-shadow:-8px 0 14px rgba(20,51,101,.08)!important}
  .fbp-outbreak-table-compact tr.fbp-current-outbreak td:last-child{background:#fff1f3!important}
}

/* Algorithm evidence counts: four explicit scientific cards, never glued text. */
.fbp-algo-evidence{display:grid!important;gap:10px!important;margin-top:14px!important;padding-top:14px!important;border-top:1px solid #d9e2ef!important}
.fbp-algo-evidence-intro{display:grid!important;gap:4px!important;padding:12px!important;border-radius:10px!important;background:#f4f7fc!important}
.fbp-algo-evidence-intro>b{font-size:15px!important;color:#173b8f!important}
.fbp-algo-evidence-intro>span{font-size:13px!important;line-height:1.5!important;color:#53627b!important}
.fbp-algo-evidence-grid{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:10px!important}
.fbp-algo-evidence-grid>span{display:grid!important;align-content:start!important;gap:5px!important;min-width:0!important;padding:12px!important;border:1px solid #d7e1ee!important;border-radius:10px!important;background:#fff!important}
.fbp-algo-evidence-grid b{display:block!important;font-size:24px!important;line-height:1!important;color:#173b8f!important;font-variant-numeric:tabular-nums!important}
.fbp-algo-evidence-grid em{display:block!important;font-style:normal!important;font-size:13px!important;font-weight:850!important;color:#273c63!important;line-height:1.3!important}
.fbp-algo-evidence-grid small{display:block!important;font-size:13px!important;line-height:1.4!important;color:#6d7890!important}

@media(max-width:1250px){
  .fbp-map-unified-metrics,.fbp-eu-map-controls{grid-template-columns:repeat(3,minmax(0,1fr))!important}
  .fbp-map-unified-metrics>.fbp-map-view-label,.fbp-eu-map-controls>.fbp-map-view-label{grid-column:1/-1!important}
  .fbp-algo-evidence-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
}
@media(max-width:760px){
  .fbp-map-unified-metrics,.fbp-eu-map-controls{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .fbp-map-unified-metrics button:last-of-type,.fbp-eu-map-controls button:last-of-type{grid-column:1/-1!important}
  .fbp-map-unified-kpis,.fbp-map-statbar{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .fbp-algo-evidence-grid{grid-template-columns:1fr!important}
}
