/* ══════════════════════════════════════════════════════════════
   WFS CI OS — BENEFITS & IMPACT TRACKER STYLES
   Module: benefits.js
══════════════════════════════════════════════════════════════ */

/* ── BENEFITS HERO HEADER ───────────────────────────────────── */
.benefits-hero {
  background: linear-gradient(135deg, #6B0010 0%, #C8001F 50%, #E8192C 100%);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 24px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.benefits-hero::after {
  content: '£';
  position: absolute;
  right: 32px; top: 50%;
  transform: translateY(-50%);
  font-size: 8rem;
  font-weight: 900;
  opacity: .06;
  line-height: 1;
  pointer-events: none;
}
.benefits-hero h1 { font-size: 1.6rem; font-weight: 900; margin-bottom: 4px; }
.benefits-hero p { font-size: .92rem; opacity: .82; max-width: 600px; line-height: 1.5; }
.benefits-hero-stats {
  display: flex; gap: 32px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,.2);
  flex-wrap: wrap;
}
.hero-stat { display: flex; flex-direction: column; }
.hero-stat-val {
  font-size: 1.8rem; font-weight: 900; line-height: 1;
  color: #fff;
}
.hero-stat-val.gold { color: #FFD700; }
.hero-stat-label { font-size: .72rem; opacity: .75; letter-spacing: .5px; text-transform: uppercase; margin-top: 2px; }

/* ── BENEFIT CARD ───────────────────────────────────────────── */
.benefit-card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--grey-150);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  overflow: hidden;
  cursor: pointer;
}
.benefit-card:hover { box-shadow: var(--shadow-md); border-color: var(--wfs-100); transform: translateY(-1px); }
.benefit-card-accent {
  height: 4px;
  width: 100%;
}
.benefit-card-body { padding: 18px 20px; }
.benefit-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.benefit-card-title { font-weight: 700; font-size: .95rem; color: var(--grey-900); line-height: 1.35; flex: 1; }
.benefit-type-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
  white-space: nowrap;
  flex-shrink: 0;
}
.benefit-card-meta { display: flex; flex-direction: column; gap: 5px; }
.benefit-card-meta-row { display: flex; justify-content: space-between; align-items: center; font-size: .8rem; }
.benefit-card-meta-label { color: var(--grey-400); }
.benefit-card-meta-value { color: var(--grey-800); font-weight: 600; }
.benefit-value-display {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--grey-50);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: space-between;
}
.benefit-value-display .amount {
  font-size: 1.4rem; font-weight: 900; color: var(--green-600);
}
.benefit-value-display .label { font-size: .72rem; color: var(--grey-400); }
.benefit-card-footer {
  padding: 10px 20px;
  background: var(--grey-50);
  border-top: 1px solid var(--grey-100);
  display: flex; align-items: center; justify-content: space-between;
}
.benefit-card-owner { display: flex; align-items: center; gap: 7px; }
.owner-avatar-sm {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.owner-name { font-size: .78rem; color: var(--grey-600); font-weight: 500; }
.owner-title-badge {
  display: inline-flex; align-items: center;
  padding: 2px 7px;
  border-radius: 8px;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .2px;
}

/* ── STATUS BADGES ──────────────────────────────────────────── */
.status-draft    { background: var(--grey-100);   color: var(--grey-600); }
.status-submitted { background: #E3F2FD;           color: #1565C0; }
.status-under_review { background: var(--amber-100); color: var(--amber-600); }
.status-approved  { background: var(--green-100);  color: var(--green-600); }
.status-rejected  { background: var(--red-100);    color: var(--red-600); }
.status-archived  { background: var(--grey-100);   color: var(--grey-400); }

/* ── CONFIDENCE PILLS ───────────────────────────────────────── */
.conf-estimated { background: var(--grey-100);   color: var(--grey-600); }
.conf-likely    { background: var(--amber-100);  color: var(--amber-600); }
.conf-confirmed { background: var(--green-100);  color: var(--green-600); }
.conf-audited   { background: #E8F5E9;           color: #1B5E20; font-weight: 800; }

/* ── BENEFIT TYPE COLOURS ───────────────────────────────────── */
.btype-financial_saving  { background: #E8F5E9; color: #2E7D32; }
.btype-cost_avoidance    { background: #E3F2FD; color: #1565C0; }
.btype-productivity      { background: #FFF3E0; color: #E65100; }
.btype-quality           { background: var(--wfs-100); color: var(--wfs-700); }
.btype-safety            { background: #FCE4EC; color: #880E4F; }
.btype-customer          { background: #E0F7FA; color: #00695C; }
.btype-compliance        { background: #EDE7F6; color: #4527A0; }
.btype-capacity          { background: #E0F2F1; color: #00695C; }
.btype-morale            { background: #FFF9C4; color: #F57F17; }
.btype-environmental     { background: #F1F8E9; color: #33691E; }

/* ── ANALYSIS SECTION ───────────────────────────────────────── */
.analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}
.analysis-card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--grey-150);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.analysis-card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--grey-100);
  display: flex; align-items: center; justify-content: space-between;
}
.analysis-card-title { font-size: .88rem; font-weight: 700; color: var(--grey-900); display: flex; align-items: center; gap: 7px; }
.analysis-card-title i { color: var(--wfs-600); }
.analysis-card-body { padding: 16px 18px; }
.chart-container-md { height: 260px; position: relative; }
.chart-container-lg { height: 320px; position: relative; }
.chart-container-sm { height: 180px; position: relative; }

/* ── EFFORT VS IMPACT MATRIX ────────────────────────────────── */
.matrix-wrap {
  position: relative;
  background: #fff;
  border: 1px solid var(--grey-150);
  border-radius: var(--radius);
  overflow: hidden;
}
.matrix-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  height: 300px;
}
.matrix-quadrant {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}
.matrix-quadrant.q1 { background: #FFF3E0; border-right: 1px solid var(--grey-200); border-bottom: 1px solid var(--grey-200); }
.matrix-quadrant.q2 { background: #E8F5E9; border-bottom: 1px solid var(--grey-200); }
.matrix-quadrant.q3 { background: #FAFAFA; border-right: 1px solid var(--grey-200); }
.matrix-quadrant.q4 { background: #FFF8E1; }
.matrix-quadrant-label {
  font-size: .68rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .5px; opacity: .6;
}
.matrix-dot {
  position: absolute;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--wfs-600);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .65rem; font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  z-index: 2;
}
.matrix-dot:hover { transform: scale(1.25); box-shadow: var(--shadow-md); z-index: 3; }
.matrix-axis-label {
  font-size: .7rem; color: var(--grey-400); font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px;
}

/* ── TEAM TRACKER ───────────────────────────────────────────── */
.team-member-card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--grey-150);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  transition: var(--transition);
}
.team-member-card:hover { box-shadow: var(--shadow); }
.team-member-header { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.team-avatar {
  width: 50px; height: 50px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; font-weight: 800; color: #fff;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.team-member-info { flex: 1; }
.team-member-name { font-weight: 700; font-size: 1rem; color: var(--grey-900); }
.team-member-site { font-size: .78rem; color: var(--grey-400); margin-top: 1px; }
.team-member-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.tm-stat { text-align: center; padding: 8px; background: var(--grey-50); border-radius: var(--radius); }
.tm-stat-val { font-size: 1.1rem; font-weight: 800; color: var(--grey-900); }
.tm-stat-val.green { color: var(--green-600); }
.tm-stat-val.wfs { color: var(--wfs-600); }
.tm-stat-label { font-size: .68rem; color: var(--grey-400); text-transform: uppercase; letter-spacing: .3px; margin-top: 1px; }
.team-progress-bar { height: 6px; background: var(--grey-150); border-radius: 4px; overflow: hidden; margin-top: 4px; }
.team-progress-fill { height: 100%; border-radius: 4px; background: var(--wfs-600); transition: width .4s ease; }

/* ── LEADERBOARD ────────────────────────────────────────────── */
.leaderboard-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 6px;
  background: #fff;
  border: 1px solid var(--grey-150);
  transition: var(--transition);
}
.leaderboard-row:hover { border-color: var(--wfs-100); box-shadow: var(--shadow-sm); }
.leaderboard-rank {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .82rem;
  flex-shrink: 0;
}
.rank-1 { background: #FFD700; color: #000; }
.rank-2 { background: #9E9E9E; color: #fff; }
.rank-3 { background: #CD7F32; color: #fff; }
.rank-other { background: var(--grey-100); color: var(--grey-600); }
.leaderboard-info { flex: 1; }
.leaderboard-name { font-weight: 600; font-size: .9rem; color: var(--grey-900); }
.leaderboard-sub { font-size: .75rem; color: var(--grey-400); }
.leaderboard-value { font-size: 1.1rem; font-weight: 800; color: var(--green-600); text-align: right; }
.leaderboard-count { font-size: .72rem; color: var(--grey-400); text-align: right; }

/* ── CI TOOLS LIBRARY ───────────────────────────────────────── */
.ci-tool-category { margin-bottom: 28px; }
.ci-tool-category-title {
  font-size: .78rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 1px; color: var(--grey-400);
  padding: 0 0 8px;
  border-bottom: 1px solid var(--grey-150);
  margin-bottom: 14px;
}
.ci-tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.ci-tool-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1.5px solid var(--grey-150);
  padding: 16px;
  cursor: pointer;
  transition: var(--transition);
  display: flex; flex-direction: column; gap: 8px;
}
.ci-tool-card:hover { border-color: var(--wfs-600); box-shadow: var(--shadow); transform: translateY(-1px); }
.ci-tool-card.active-tool { border-color: var(--wfs-600); background: var(--wfs-50); }
.ci-tool-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}
.ci-tool-name { font-weight: 700; font-size: .9rem; color: var(--grey-900); }
.ci-tool-desc { font-size: .75rem; color: var(--grey-500); line-height: 1.4; }
.ci-tool-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
  background: var(--grey-100);
  color: var(--grey-600);
  margin-top: 2px;
  width: fit-content;
}

/* ── BENEFIT DETAIL PANEL ───────────────────────────────────── */
.benefit-detail-header {
  display: flex; align-items: flex-start; gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--grey-150);
  margin-bottom: 20px;
}
.benefit-detail-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.benefit-detail-title { font-size: 1.2rem; font-weight: 700; color: var(--grey-900); margin-bottom: 6px; }
.benefit-detail-meta { display: flex; flex-wrap: wrap; gap: 6px; }

.benefit-metrics-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.benefit-metric-box {
  background: var(--grey-50);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  border: 1px solid var(--grey-150);
}
.benefit-metric-val { font-size: 1.4rem; font-weight: 800; color: var(--grey-900); line-height: 1; }
.benefit-metric-val.green { color: var(--green-600); }
.benefit-metric-val.wfs { color: var(--wfs-600); }
.benefit-metric-val.gold { color: var(--amber-600); }
.benefit-metric-label { font-size: .7rem; color: var(--grey-400); text-transform: uppercase; letter-spacing: .3px; margin-top: 4px; }

.comment-thread { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.comment-item {
  background: var(--grey-50);
  border-radius: var(--radius);
  padding: 12px 14px;
  border-left: 3px solid var(--grey-200);
}
.comment-item.review_note { border-color: var(--amber-400); background: var(--amber-100); }
.comment-item.approval { border-color: var(--green-400); background: var(--green-100); }
.comment-item.rejection { border-color: var(--red-400); background: var(--red-100); }
.comment-item.query { border-color: #1565C0; background: #E3F2FD; }
.comment-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.comment-author { font-weight: 600; font-size: .82rem; color: var(--grey-800); display: flex; align-items: center; gap: 6px; }
.comment-time { font-size: .72rem; color: var(--grey-400); }
.comment-text { font-size: .85rem; color: var(--grey-700); line-height: 1.5; }

/* ── LOG BENEFIT FORM ───────────────────────────────────────── */
.log-form-section {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--grey-150);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.log-form-section-title {
  font-size: .82rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .8px; color: var(--wfs-600);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--wfs-100);
  display: flex; align-items: center; gap: 8px;
}
.roi-calculator {
  background: linear-gradient(135deg, #E8F5E9, #F1F8E9);
  border: 1px solid #C8E6C9;
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 12px;
}
.roi-calculator h4 { font-size: .82rem; font-weight: 700; color: var(--green-700); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.roi-result { display: flex; gap: 16px; flex-wrap: wrap; }
.roi-item { text-align: center; }
.roi-val { font-size: 1.2rem; font-weight: 800; color: var(--green-700); }
.roi-label { font-size: .7rem; color: var(--grey-500); text-transform: uppercase; }

/* ── VALIDATION FLOW ────────────────────────────────────────── */
.validation-panel {
  background: var(--amber-100);
  border: 1px solid var(--amber-400);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 16px;
}
.validation-panel i { color: var(--amber-600); font-size: 1.2rem; flex-shrink: 0; }
.validation-panel-text { flex: 1; font-size: .85rem; color: var(--amber-700); }
.validation-actions { display: flex; gap: 8px; }

/* ── FILTER CHIPS ───────────────────────────────────────────── */
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 600;
  border: 1.5px solid var(--grey-200);
  background: #fff;
  color: var(--grey-600);
  cursor: pointer;
  transition: var(--transition);
}
.filter-chip:hover { border-color: var(--wfs-600); color: var(--wfs-600); }
.filter-chip.active { background: var(--wfs-600); color: #fff; border-color: var(--wfs-600); }

/* ── KPI DELTA DISPLAY ──────────────────────────────────────── */
.baseline-improved-wrap {
  display: flex; align-items: center; gap: 12px;
  background: var(--grey-50);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-top: 8px;
}
.bi-val { text-align: center; }
.bi-num { font-size: 1.3rem; font-weight: 800; color: var(--grey-900); }
.bi-num.improved { color: var(--green-600); }
.bi-label { font-size: .7rem; color: var(--grey-400); }
.bi-arrow { font-size: 1.4rem; color: var(--green-500); }
.bi-delta {
  text-align: center;
  background: var(--green-100);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
}
.bi-delta-val { font-size: 1.1rem; font-weight: 800; color: var(--green-600); }
.bi-delta-label { font-size: .68rem; color: var(--green-500); }

/* ── PARETO CHART INFO ──────────────────────────────────────── */
.pareto-80-line {
  position: absolute;
  top: 0; bottom: 0;
  border-left: 2px dashed var(--wfs-600);
  pointer-events: none;
}
.pareto-label {
  position: absolute;
  top: 4px;
  background: var(--wfs-600);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

/* ── FORECAST SECTION ───────────────────────────────────────── */
.forecast-info-box {
  background: linear-gradient(135deg, var(--wfs-50), #fff);
  border: 1px solid var(--wfs-100);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex; gap: 12px; align-items: flex-start;
}
.forecast-info-box i { color: var(--wfs-600); font-size: 1.1rem; margin-top: 2px; flex-shrink: 0; }

/* ── SAVINGS SUMMARY BAND ───────────────────────────────────── */
.savings-band {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  background: linear-gradient(135deg, #F8F4F5, #FFF5F6);
  border: 1px solid var(--wfs-100);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 20px;
}
.savings-band-item { text-align: center; }
.savings-band-val { font-size: 1.5rem; font-weight: 900; color: var(--wfs-600); line-height: 1; }
.savings-band-val.big { font-size: 2rem; color: var(--green-600); }
.savings-band-label { font-size: .7rem; color: var(--grey-400); text-transform: uppercase; letter-spacing: .5px; margin-top: 3px; }

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .analysis-grid { grid-template-columns: 1fr; }
  .benefit-metrics-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .benefits-hero { padding: 20px; }
  .benefits-hero-stats { gap: 20px; }
  .team-member-stats { grid-template-columns: repeat(2, 1fr); }
  .savings-band { grid-template-columns: repeat(2, 1fr); }
}
