/* ============================================================
   PHB MRI Safety Dashboard
   PHB Design System: navy #0d2b4e / teal #1d9e75 / gold #ba7517
   Playfair Display (headings) + Source Sans 3 (body)
   All styles scoped to #phb-root for WordPress isolation.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700;800&family=Source+Sans+3:wght@400;500;600;700&display=swap');

body { background: transparent !important; }

#phb-root {
  --phb-navy: #0d2b4e;
  --phb-navy-2: #14406f;
  --phb-teal: #1d9e75;
  --phb-teal-d: #167a5a;
  --phb-gold: #ba7517;
  --phb-gold-l: #d8973a;
  --phb-bg: #f4f6f9;
  --phb-card: #ffffff;
  --phb-border: #e1e7ef;
  --phb-text: #1f2d3d;
  --phb-muted: #5f6f80;
  --phb-red: #c0392b;
  --phb-amber: #d6920e;
  --phb-green: #1d9e75;

  background: #f4f6f9;
  color: #1f2d3d;
  font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.6;
  font-size: 16px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(13, 43, 78, 0.10);
}

#phb-root *,
#phb-root *::before,
#phb-root *::after { box-sizing: border-box; }

#phb-root h1, #phb-root h2, #phb-root h3, #phb-root h4 {
  font-family: 'Playfair Display', Georgia, serif;
  color: #0d2b4e;
  margin: 0 0 .4em;
  line-height: 1.25;
}

#phb-root p { margin: 0 0 1em; }
#phb-root a { color: #167a5a; }

/* ---------- Masthead ---------- */
#phb-root .phb-masthead {
  background: linear-gradient(135deg, #0d2b4e 0%, #14406f 60%, #167a5a 130%);
  color: #fff;
  padding: 34px 38px 30px;
}
#phb-root .phb-masthead .phb-eyebrow {
  text-transform: uppercase;
  letter-spacing: .22em;
  font-size: .72rem;
  font-weight: 700;
  color: #d8973a;
  margin-bottom: 10px;
}
#phb-root .phb-masthead h1 {
  color: #fff;
  font-size: 2.05rem;
  font-weight: 800;
  margin-bottom: 8px;
}
#phb-root .phb-masthead p {
  color: #cdd9e6;
  max-width: 880px;
  margin: 0;
  font-size: 1rem;
}
#phb-root .phb-mast-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  margin-top: 18px;
  font-size: .82rem;
  color: #aebfd2;
}
#phb-root .phb-mast-meta span { display: flex; align-items: center; gap: 7px; }
#phb-root .phb-mast-meta strong { color: #fff; font-weight: 600; }

/* ---------- Sticky tab nav ---------- */
#phb-root .phb-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  background: #0d2b4e;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 0 16px;
  border-bottom: 3px solid #ba7517;
}
#phb-root .phb-nav button {
  background: transparent;
  border: 0;
  color: #aebfd2;
  font-family: 'Source Sans 3', sans-serif;
  font-size: .9rem;
  font-weight: 600;
  padding: 15px 16px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -3px;
  transition: color .15s, border-color .15s, background .15s;
  white-space: nowrap;
}
#phb-root .phb-nav button:hover { color: #fff; background: rgba(255,255,255,.05); }
#phb-root .phb-nav button.active {
  color: #fff;
  border-bottom-color: #ba7517;
  background: rgba(255,255,255,.06);
}

/* ---------- Panels ---------- */
#phb-root .phb-body { padding: 32px 38px 44px; }
#phb-root .phb-panel { display: none; animation: phbFade .35s ease; }
#phb-root .phb-panel.active { display: block; }
@keyframes phbFade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

#phb-root .phb-section-head { margin-bottom: 22px; }
#phb-root .phb-section-head h2 { font-size: 1.6rem; }
#phb-root .phb-section-head p { color: #5f6f80; max-width: 880px; margin: 0; }
#phb-root .phb-kicker {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #ba7517;
  margin-bottom: 8px;
}

/* ---------- Stat cards ---------- */
#phb-root .phb-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  margin-bottom: 30px;
}
#phb-root .phb-stat {
  background: #fff;
  border: 1px solid #e1e7ef;
  border-radius: 12px;
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
}
#phb-root .phb-stat::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
  background: #1d9e75;
}
#phb-root .phb-stat.amber::before { background: #d6920e; }
#phb-root .phb-stat.red::before { background: #c0392b; }
#phb-root .phb-stat.navy::before { background: #14406f; }
#phb-root .phb-stat .phb-stat-val {
  font-family: 'Playfair Display', serif;
  font-size: 2.1rem;
  font-weight: 800;
  color: #0d2b4e;
  line-height: 1;
}
#phb-root .phb-stat .phb-stat-label {
  font-size: .82rem;
  color: #5f6f80;
  margin-top: 8px;
  font-weight: 600;
}
#phb-root .phb-stat .phb-stat-sub {
  font-size: .76rem;
  color: #8493a4;
  margin-top: 4px;
}

/* ---------- Generic cards ---------- */
#phb-root .phb-card {
  background: #fff;
  border: 1px solid #e1e7ef;
  border-radius: 12px;
  padding: 24px 26px;
  margin-bottom: 22px;
}
#phb-root .phb-card h3 { font-size: 1.18rem; }
#phb-root .phb-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
#phb-root .phb-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
#phb-root .phb-chart-wrap { position: relative; height: 320px; }
#phb-root .phb-chart-wrap.tall { height: 380px; }

/* ---------- Hazard cards w/ severity dots ---------- */
#phb-root .phb-hazard {
  background: #fff;
  border: 1px solid #e1e7ef;
  border-radius: 12px;
  padding: 0;
  margin-bottom: 16px;
  overflow: hidden;
  transition: box-shadow .15s;
}
#phb-root .phb-hazard:hover { box-shadow: 0 6px 22px rgba(13,43,78,.08); }
#phb-root .phb-hazard-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 22px;
  cursor: pointer;
  background: #fbfcfe;
  border-bottom: 1px solid #eef2f7;
}
#phb-root .phb-hazard-head h4 { margin: 0; font-size: 1.05rem; flex: 1; }
#phb-root .phb-sev {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 4px 10px;
  border-radius: 999px;
}
#phb-root .phb-sev .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
#phb-root .phb-sev.high { background: #fbe9e7; color: #a13125; }
#phb-root .phb-sev.high .dot { background: #c0392b; }
#phb-root .phb-sev.med { background: #fdf2dd; color: #8a5e08; }
#phb-root .phb-sev.med .dot { background: #d6920e; }
#phb-root .phb-sev.low { background: #e3f4ee; color: #136047; }
#phb-root .phb-sev.low .dot { background: #1d9e75; }
#phb-root .phb-hazard-toggle { color: #8493a4; font-size: 1.3rem; transition: transform .2s; }
#phb-root .phb-hazard.open .phb-hazard-toggle { transform: rotate(45deg); }
#phb-root .phb-hazard-body { display: none; padding: 18px 22px 22px; }
#phb-root .phb-hazard.open .phb-hazard-body { display: block; }
#phb-root .phb-hazard-body ul { margin: 8px 0 0; padding-left: 20px; }
#phb-root .phb-hazard-body li { margin-bottom: 6px; }
#phb-root .phb-tag {
  display: inline-block;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 3px 9px;
  border-radius: 5px;
  margin-right: 6px;
}
#phb-root .phb-tag.direct { background: #e7eef7; color: #14406f; }
#phb-root .phb-tag.indirect { background: #f3ece1; color: #8a5e08; }

/* ---------- Zone diagram ---------- */
#phb-root .phb-zones { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
#phb-root .phb-zone {
  border-radius: 10px;
  padding: 18px 16px;
  color: #fff;
  text-align: center;
}
#phb-root .phb-zone h4 { color: #fff; font-size: 1rem; margin-bottom: 6px; }
#phb-root .phb-zone p { font-size: .82rem; margin: 0; color: rgba(255,255,255,.92); }
#phb-root .phb-zone.z1 { background: #1d9e75; }
#phb-root .phb-zone.z2 { background: #5a8fb0; }
#phb-root .phb-zone.z3 { background: #d6920e; }
#phb-root .phb-zone.z4 { background: #c0392b; }

/* ---------- Regulatory / data cards ---------- */
#phb-root .phb-reg {
  background: #fff;
  border: 1px solid #e1e7ef;
  border-left: 5px solid #14406f;
  border-radius: 10px;
  padding: 18px 22px;
  margin-bottom: 14px;
}
#phb-root .phb-reg h4 { font-size: 1.02rem; margin-bottom: 4px; }
#phb-root .phb-reg .phb-reg-org {
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #ba7517;
  margin-bottom: 6px;
}
#phb-root .phb-reg p { margin: 0 0 8px; font-size: .94rem; }
#phb-root .phb-reg .phb-maps {
  font-size: .82rem;
  color: #5f6f80;
  background: #f4f6f9;
  border-radius: 6px;
  padding: 8px 12px;
}
#phb-root .phb-reg .phb-maps strong { color: #167a5a; }

/* ---------- Persona / role switcher ---------- */
#phb-root .phb-role-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
#phb-root .phb-role-tabs button {
  border: 1px solid #cdd9e6;
  background: #fff;
  color: #14406f;
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 600;
  font-size: .88rem;
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s;
}
#phb-root .phb-role-tabs button:hover { border-color: #1d9e75; }
#phb-root .phb-role-tabs button.active {
  background: #0d2b4e;
  color: #fff;
  border-color: #0d2b4e;
}
#phb-root .phb-role-view { display: none; }
#phb-root .phb-role-view.active { display: block; }
#phb-root .phb-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 16px;
}
#phb-root .phb-kpi {
  background: #f8fafc;
  border: 1px solid #e6edf4;
  border-radius: 10px;
  padding: 16px 18px;
}
#phb-root .phb-kpi .phb-kpi-name {
  font-weight: 700;
  color: #0d2b4e;
  font-size: .92rem;
  margin-bottom: 4px;
}
#phb-root .phb-kpi .phb-kpi-desc { font-size: .82rem; color: #5f6f80; }

/* ---------- Screening tool ---------- */
#phb-root .phb-screen-q {
  background: #fff;
  border: 1px solid #e1e7ef;
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
#phb-root .phb-screen-q .phb-q-text { flex: 1; min-width: 240px; font-weight: 500; }
#phb-root .phb-screen-q .phb-q-cat {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #8493a4;
  display: block;
  margin-bottom: 3px;
}
#phb-root .phb-yn { display: flex; gap: 8px; }
#phb-root .phb-yn button {
  border: 1.5px solid #cdd9e6;
  background: #fff;
  color: #5f6f80;
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 700;
  font-size: .82rem;
  padding: 8px 18px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .12s;
}
#phb-root .phb-yn button.sel-yes { background: #c0392b; border-color: #c0392b; color: #fff; }
#phb-root .phb-yn button.sel-no { background: #1d9e75; border-color: #1d9e75; color: #fff; }
#phb-root .phb-screen-result {
  border-radius: 12px;
  padding: 26px 28px;
  margin-top: 22px;
  color: #fff;
  display: none;
}
#phb-root .phb-screen-result.show { display: block; }
#phb-root .phb-screen-result h3 { color: #fff; font-size: 1.4rem; margin-bottom: 8px; }
#phb-root .phb-screen-result p { margin: 0 0 6px; color: rgba(255,255,255,.95); }
#phb-root .phb-screen-result.cleared { background: linear-gradient(135deg,#167a5a,#1d9e75); }
#phb-root .phb-screen-result.conditional { background: linear-gradient(135deg,#b67d10,#d6920e); }
#phb-root .phb-screen-result.contra { background: linear-gradient(135deg,#a13125,#c0392b); }
#phb-root .phb-btn {
  background: #ba7517;
  color: #fff;
  border: 0;
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 700;
  font-size: .92rem;
  padding: 12px 26px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s;
}
#phb-root .phb-btn:hover { background: #a3650f; }
#phb-root .phb-btn.ghost { background: transparent; color: #14406f; border: 1.5px solid #cdd9e6; }
#phb-root .phb-btn.ghost:hover { background: #eef2f7; }
#phb-root .phb-btn-row { display: flex; gap: 12px; margin-top: 18px; flex-wrap: wrap; }

/* ---------- Roadmap timeline ---------- */
#phb-root .phb-timeline { position: relative; margin-left: 14px; padding-left: 30px; border-left: 3px solid #cdd9e6; }
#phb-root .phb-phase { position: relative; margin-bottom: 26px; }
#phb-root .phb-phase::before {
  content: '';
  position: absolute;
  left: -41px; top: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #ba7517;
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px #cdd9e6;
}
#phb-root .phb-phase h4 { font-size: 1.06rem; margin-bottom: 3px; }
#phb-root .phb-phase .phb-phase-num {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #ba7517;
}
#phb-root .phb-phase p { font-size: .92rem; color: #5f6f80; margin: 4px 0 0; }

/* ---------- Cost-benefit calculator ---------- */
#phb-root .phb-calc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid #eef2f7;
  flex-wrap: wrap;
}
#phb-root .phb-calc-row label { font-weight: 600; color: #1f2d3d; flex: 1; min-width: 220px; }
#phb-root .phb-calc-row input[type=range] { flex: 1; min-width: 180px; accent-color: #1d9e75; }
#phb-root .phb-calc-row .phb-calc-out {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  color: #0d2b4e;
  min-width: 110px;
  text-align: right;
}
#phb-root .phb-calc-result {
  margin-top: 20px;
  background: linear-gradient(135deg,#0d2b4e,#14406f);
  color: #fff;
  border-radius: 12px;
  padding: 24px 28px;
}
#phb-root .phb-calc-result h3 { color: #fff; }
#phb-root .phb-calc-result .phb-big {
  font-family: 'Playfair Display', serif;
  font-size: 2.4rem;
  font-weight: 800;
  color: #d8973a;
}

/* ---------- Reference pills ---------- */
#phb-root .phb-ref-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
#phb-root .phb-ref-filter button {
  border: 1px solid #cdd9e6;
  background: #fff;
  color: #5f6f80;
  font-family: 'Source Sans 3', sans-serif;
  font-size: .8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
}
#phb-root .phb-ref-filter button.active { background: #167a5a; color: #fff; border-color: #167a5a; }
#phb-root .phb-ref {
  background: #fff;
  border: 1px solid #e1e7ef;
  border-radius: 9px;
  padding: 14px 18px;
  margin-bottom: 10px;
  font-size: .9rem;
}
#phb-root .phb-ref .phb-ref-src {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #ba7517;
}
#phb-root .phb-ref a { word-break: break-all; font-size: .82rem; }

/* ---------- Misc ---------- */
#phb-root .phb-note {
  background: #fdf6e9;
  border: 1px solid #ecd9b0;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: .86rem;
  color: #7a5a12;
  margin-top: 16px;
}
#phb-root .phb-foot {
  background: #0d2b4e;
  color: #aebfd2;
  padding: 20px 38px;
  font-size: .8rem;
}
#phb-root .phb-foot a { color: #d8973a; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  #phb-root .phb-grid-2,
  #phb-root .phb-grid-3 { grid-template-columns: 1fr; }
  #phb-root .phb-zones { grid-template-columns: 1fr 1fr; }
  #phb-root .phb-body { padding: 22px 18px 32px; }
  #phb-root .phb-masthead { padding: 26px 20px; }
  #phb-root .phb-masthead h1 { font-size: 1.55rem; }
  #phb-root .phb-foot { padding: 18px 20px; }
}
