/* ── KPI 3D Bar Chart ─────────────────────────────────────────── */
.kpi3d {
  position: relative;
  min-height: 100vh;
  background: #0a1628;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 80px 0 calc(var(--arc-nav-h, 88px) + 1.5rem);
  overflow: hidden;
}

.kpi3d::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.022) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

.kpi3d::after {
  content: '';
  position: absolute;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 700px; height: 300px;
  background: radial-gradient(ellipse at center bottom,
    rgba(117,192,68,0.07) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ── Head ─────────────────────────────────────────────────────── */
.kpi3d__head {
  text-align: center;
  padding: 0 2rem 52px;
  position: relative;
  z-index: 2;
}

.kpi3d__eyebrow {
  display: block;
  font-family: var(--font-display, sans-serif);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #7fb942;
  margin-bottom: 16px;
}

.kpi3d__heading {
  font-family: var(--font-display, sans-serif);
  /* 35px on desktop; shrinks on narrow screens so it stays one line */
  font-size: clamp(13px, 3.3vw, 35px);
  font-weight: 800;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin: 0;
  white-space: nowrap;
}

.kpi3d__head-line {
  display: none;
}

/* ── Body ─────────────────────────────────────────────────────── */
.kpi3d__body {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 3rem);
}

.kpi3d__unit-row {
  display: flex;
  justify-content: flex-end;   /* unit sits below the title line, right-aligned */
  width: 100%;
  margin: 0 0 10px;
}

.kpi3d__unit {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: none;
  color: rgba(255,255,255,0.7);
}

/* ── Chart container ──────────────────────────────────────────── */
.kpi3d__chart-wrap { position: relative; }

.kpi3d__chart {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 22px;
  /* height will be set by the SVG bars themselves */
  padding-bottom: 4px;
}

/* Floor line */
.kpi3d__floor {
  width: 100%; height: 2px;
  background: #6cb33f;   /* green baseline below the graph (matches report) */
  margin-top: 0;
}

/* ── Bar column ───────────────────────────────────────────────── */
.kpi3d__bar-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  flex: 0 0 auto;          /* fixed size — no stretching */
  width: 105px;            /* SVG_W (97px) + small padding */
  min-width: 0;
}

.kpi3d__bar-val {
  font-family: var(--font-display, sans-serif);
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.45s ease;   /* no delay — number fades in WITH its bar */
  line-height: 1.2;
  padding-left: 2px;
}

.kpi3d__bar-col.bar-ready .kpi3d__bar-val { opacity: 1; }

/* ── SVG bar wrapper ──────────────────────────────────────────── */
.kpi3d__bar-svg-wrap {
  position: relative;
  cursor: pointer;
}

/* ── Year label ───────────────────────────────────────────────── */
.kpi3d__bar-yr {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.55);
  margin-top: 14px;
  text-transform: uppercase;
  padding-left: 2px;
}

.kpi3d__bar-col--last .kpi3d__bar-yr {
  color: #76c044;
  font-weight: 700;
}

/* ── Axis label ───────────────────────────────────────────────── */
.kpi3d__axis-label {
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  margin-top: 12px;
}

/* ── Navigation ───────────────────────────────────────────────── */
/*  Layout: [left side tabs]  [← ACTIVE NAME →]  [right side tabs]  */
.kpi3d__nav {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 980px;
  margin-top: 28px;
  padding: 0 clamp(1rem, 4vw, 3rem);
  gap: 0;
}

/* Left / Right side tabs containers */
.kpi3d__nav-sides {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1;
}

.kpi3d__nav-sides--left  { justify-content: flex-end; }
.kpi3d__nav-sides--right { justify-content: flex-start; }

/* Side tab buttons */
.kpi3d__side-tab {
  font-family: var(--font-display, sans-serif);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 10px 18px;
  white-space: nowrap;
  transition: color 0.25s;
}

.kpi3d__side-tab:hover { color: rgba(255,255,255,0.65); }

/* Distance styling — closer = slightly brighter */
.kpi3d__side-tab[data-dist="1"] { color: rgba(255,255,255,0.38); }
.kpi3d__side-tab[data-dist="2"] { color: rgba(255,255,255,0.22); }

/* Center block: ← ACTIVE → */
.kpi3d__nav-center {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Active category name */
.kpi3d__nav-active-name {
  font-family: var(--font-display, sans-serif);
  font-size: clamp(16px, 1.8vw, 24px);
  font-weight: 900;
  letter-spacing: 0.03em;
  text-transform: none;
  color: #ffffff;
  white-space: nowrap;
  min-width: 160px;
  text-align: center;
}

/* Arrow buttons */
.kpi3d__nav-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.25);
  background: transparent;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.25s, color 0.25s, transform 0.2s;
}

.kpi3d__nav-arrow:hover {
  border-color: #75c044;
  color: #75c044;
  transform: scale(1.08);
}

.kpi3d__nav-arrow svg { width: 18px; height: 18px; }

/* ── CTA ───────────────────────────────────────────────────────── */
.kpi3d__cta-wrap {
  margin-top: 1.2rem;
  display: flex;
  justify-content: center;
}

/* .kpi3d__cta — shimmer pill handled by shared rule in base.css */
.kpi3d__cta-arrow {
  display: inline-block;
  transition: transform 0.22s;
}
.kpi3d__cta:hover .kpi3d__cta-arrow { transform: translateX(5px); }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  .kpi3d__nav-active-name { font-size: 18px; min-width: 120px; }
  .kpi3d__nav-arrow { width: 38px; height: 38px; }
  .kpi3d__side-tab  { font-size: 11px; padding: 8px 10px; }
}

@media (max-width: 480px) {
  .kpi3d__side-tab[data-dist="2"] { display: none; }
}

/* ── Dual chart panels ────────────────────────────────────────── */
.kpi3d__dual {
  display: flex;
  align-items: flex-start;
  width: 100%;
  gap: 0;
  position: relative;
}

.kpi3d__panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 0.75rem;
  position: relative;
}

/* Divider between panels */
.kpi3d__panel:first-child {
  border-right: 1px solid rgba(255,255,255,0.07);
}

/* KPI title row ABOVE each chart: title (left) + unit (right) + divider line */
.kpi3d__panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 14px;
  width: 100%;
  padding-bottom: 9px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.20);
}
.kpi3d__panel-name {
  font-family: var(--font-display, sans-serif);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: rgba(255,255,255,0.92);
  text-align: left;
  margin: 0;
  line-height: 1.2;
  flex: 1 1 auto;
  min-width: 0;
}
.kpi3d__panel-head .kpi3d__unit { text-align: right; flex: 0 1 auto; }

/* Override bar sizing for dual layout — use full ancestor chain for specificity */
.kpi3d__layout .kpi3d__dual .kpi3d__bar-col   { width: 42px; }
.kpi3d__layout .kpi3d__dual .kpi3d__chart     { gap: 8px; }
.kpi3d__layout .kpi3d__dual .kpi3d__bar-val   { font-size: 12px; margin-bottom: 5px; }
.kpi3d__layout .kpi3d__dual .kpi3d__bar-yr    { font-size: 10px; margin-top: 6px; }
.kpi3d__layout .kpi3d__dual .kpi3d__unit-row  { width: 100%; margin: 0 0 8px; padding-right: 2px; }
.kpi3d__layout .kpi3d__dual .kpi3d__body      { max-width: 100%; padding: 0; }

/* ── Pair dots ────────────────────────────────────────────────── */
.kpi3d__pair-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.kpi3d__pair-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.20);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: background 0.25s, transform 0.25s;
  flex-shrink: 0;
}

.kpi3d__pair-dot:hover {
  background: rgba(255,255,255,0.45);
}

.kpi3d__pair-dot.is-active {
  background: #75c044;
  transform: scale(1.25);
}

/* ── 2-Column Layout (tabs + centre) ─────────────────────────── */
/* ── 3-Column Layout ──────────────────────────────────────────── */
.kpi3d__layout {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  max-width: 1300px;
  gap: clamp(1.5rem, 3vw, 3rem);
  position: relative;
  z-index: 1;
  padding: 0 clamp(1rem, 3vw, 2rem);
}

/* ── LHS: Category tabs ───────────────────────────────────────── */
.kpi3d__cat-tabs {
  display: flex;
  flex-direction: column;
  width: 210px;
  flex-shrink: 0;
  padding-top: 2.5rem;
  gap: 4px;
}

.kpi3d__cat-tab {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  padding: 1rem 1.25rem;
  border: none;
  border-left: 2px solid rgba(255,255,255,0.08);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background 0.25s, border-color 0.25s;
  border-radius: 0 6px 6px 0;
}

.kpi3d__cat-tab:hover {
  background: rgba(255,255,255,0.04);
  border-left-color: rgba(255,255,255,0.2);
}

.kpi3d__cat-tab.is-active {
  background: rgba(117,192,68,0.09);
  border-left-color: #75c044;
}

.kpi3d__cat-num {
  font-family: var(--font-display, sans-serif);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: rgba(255,255,255,0.25);
  line-height: 1.8;
  flex-shrink: 0;
}

.kpi3d__cat-tab.is-active .kpi3d__cat-num { color: #75c044; }

.kpi3d__cat-label {
  font-family: var(--font-display, sans-serif);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.38);
  line-height: 1.4;
}

.kpi3d__cat-tab.is-active .kpi3d__cat-label { color: #ffffff; }

/* ── Centre column ────────────────────────────────────────────── */
.kpi3d__center {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── RHS: Trend chart ─────────────────────────────────────────── */
.kpi3d__rhs {
  width: 200px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 2rem;
  gap: 0.5rem;
}

.kpi3d__rhs-title {
  font-family: var(--font-display, sans-serif);
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  text-align: center;
  white-space: nowrap;
}

.kpi3d__rhs-svg {
  width: 100%;
  max-width: 200px;
  display: block;
  overflow: visible;
}

/* ── Adjust bar text sizes for smaller bars ───────────────────── */
.kpi3d__layout .kpi3d__bar-val {
  font-size: 16px;
  margin-bottom: 7px;
}

.kpi3d__layout .kpi3d__bar-yr {
  font-size: 12px;
  margin-top: 8px;
}

.kpi3d__layout .kpi3d__bar-col {
  width: 82px;
}

.kpi3d__layout .kpi3d__chart {
  gap: 14px;
}

.kpi3d__layout .kpi3d__unit-row {
  width: 100%;
  margin: 0 0 8px;
  padding-right: 4px;
}

.kpi3d__layout .kpi3d__body {
  max-width: 100%;
  padding: 0;
}

.kpi3d__layout .kpi3d__nav {
  max-width: 100%;
  margin-top: 20px;
}

/* ── Responsive: collapse to vertical on narrow screens ──────── */
@media (max-width: 960px) {
  .kpi3d__layout {
    flex-direction: column;
    align-items: center;
  }
  .kpi3d__cat-tabs {
    flex-direction: row;
    width: 100%;
    max-width: 600px;
    padding-top: 0;
    gap: 8px;
  }
  .kpi3d__cat-tab {
    flex: 1;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.75rem 1rem;
    border-left: none;
    border-top: 2px solid rgba(255,255,255,0.08);
    border-radius: 6px 6px 0 0;
    align-items: center;
    text-align: center;
  }
  .kpi3d__cat-tab.is-active {
    border-top-color: #75c044;
  }
  .kpi3d__cat-label { font-size: 0.62rem; }
  .kpi3d__rhs {
    width: 100%;
    max-width: 360px;
  }
  .kpi3d__rhs-svg { max-width: 360px; }
}

/* ── Quick Links (below KPI chart) ──────────────────────────── */
.kpi-ql {
  background: #0d1c30;
  padding: clamp(3rem, 6vw, 5rem) clamp(2rem, 5vw, 5rem);
}

.kpi-ql__inner {
  max-width: 1200px;
  margin: 0 auto;
}

.kpi-ql__heading {
  font-family: var(--font-display);
  font-size: 35px;
  font-weight: 700;
  color: #7fb942;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 2rem;
}

.kpi-ql__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.kpi-ql__card {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  background: transparent;
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 1.5rem;
  height: 90px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  position: relative;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, background 0.25s ease;
  word-break: break-word;
}

/* Subtle shine line at top */
.kpi-ql__card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.30), transparent);
  pointer-events: none;
}

.kpi-ql__card:hover {
  transform: translateY(-4px);
  background: rgba(127, 185, 66, 0.06);
  border-color: rgba(127, 185, 66, 0.40);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
}

.kpi-ql__card-text { flex: 1; }

/* Arrow icon — inline SVG, no external asset needed */
.kpi-ql__card-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-left: 1rem;
  flex-shrink: 0;
  opacity: 0.55;
  transition: opacity 0.2s ease, transform 0.2s ease;
  color: #7fb942;
}

.kpi-ql__card:hover .kpi-ql__card-arrow {
  opacity: 1;
  transform: translate(3px, -3px);
}

/* Last row: 2 cards — align left */
.kpi-ql__card:nth-child(4) { grid-column: 1 / 2; }
.kpi-ql__card:nth-child(5) { grid-column: 2 / 3; }

@media (max-width: 768px) {
  .kpi-ql__grid { grid-template-columns: 1fr; }
  .kpi-ql__card:nth-child(4),
  .kpi-ql__card:nth-child(5) { grid-column: auto; }
}


/* ════════════════════════════════════════════════════════════════
   Tab 2 (stacked + breakdown table) & Tab 3 (grouped + legend)
   ════════════════════════════════════════════════════════════════ */
.kpi3d__bars-row {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 22px;
  width: 100%;
  border-bottom: 2px solid #6cb33f;   /* green baseline directly under the bars */
  padding-bottom: 4px;
}

/* Grouped: two bars (Zinc/Lead) per year */
.kpi3d__grp-col { width: auto !important; align-items: center; }
.kpi3d__grp-pair { display: flex; align-items: flex-end; gap: 6px; }
.kpi3d__grp-bar { display: flex; flex-direction: column; align-items: center; }

/* Legend */
.kpi3d__legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin-top: 16px;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.82);
}
.kpi3d__legend-item { display: inline-flex; align-items: center; }
.kpi3d__legend-dot {
  width: 12px; height: 12px; margin-right: 7px; border-radius: 2px; display: inline-block;
}
.kpi3d__legend-dot--zinc { background: #75c044; }
.kpi3d__legend-dot--lead { background: #868a8d; }

/* Breakdown table (Zinc/Lead MT) */
.kpi3d__table {
  width: 100%;
  margin-top: 18px;
  border-collapse: collapse;
  font-size: 11.5px;
  color: rgba(255,255,255,0.82);
}
.kpi3d__table th,
.kpi3d__table td {
  padding: 7px 8px;
  text-align: center;
  border-top: 1px solid rgba(255,255,255,0.10);
  white-space: nowrap;
}
.kpi3d__table thead th {
  font-weight: 700;
  color: rgba(255,255,255,0.6);
  border-top: none;
  letter-spacing: 0.02em;
}
.kpi3d__table-rowh {
  text-align: left !important;
  font-weight: 700;
  white-space: nowrap;
}
.kpi3d__table-rowh--zinc { color: #8fd85a; }
.kpi3d__table-rowh--lead { color: #b6babd; }

/* Highlight the latest year (last column) with a blue tint */
.kpi3d__table-col--hl { background: rgba(0, 105, 170, 0.28); }
.kpi3d__table thead th.kpi3d__table-col--hl { color: #ffffff; }
body.energy-saver .kpi3d__table-col--hl { background: rgba(0, 105, 170, 0.14); }

/* Grouped value labels read vertically (bottom-to-top) like the report */
.kpi3d__grp-bar .kpi3d__bar-val {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  margin: 0 0 6px;
  opacity: 1;
}
