:root {
  --green-key: #176b49;
  --green-key-soft: #eaf5ef;
}

.green-filter-head {
  min-height: 58px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.green-filter-head > div { min-width: 0; }
.green-filter-head strong { display: block; margin-bottom: 7px; font-size: 0.72rem; text-transform: uppercase; }
.family-buttons { display: flex; gap: 5px; flex-wrap: wrap; }
.family-buttons button {
  min-height: 34px;
  padding: 6px 10px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-weight: 800;
}
.family-buttons button:hover { color: var(--ink); background: var(--soft); }
.family-buttons button.active { color: #fff; background: var(--ink); border-color: var(--ink); }

.green-filters {
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(260px, 2fr) minmax(130px, 0.7fr) minmax(130px, 0.7fr) minmax(260px, 1.4fr) auto;
  align-items: end;
  gap: 10px;
  border-top: 1px solid var(--line);
}
.green-filters label,
.metric-control { min-width: 0; display: grid; gap: 6px; color: #505962; font-size: 0.72rem; font-weight: 800; text-transform: uppercase; }
.green-filters select { width: 100%; height: 40px; padding: 8px 10px; border: 1px solid #cbd2d8; border-radius: 4px; }
.metric-control .chart-modes { justify-self: start; }
.chart-modes button:disabled { cursor: not-allowed; opacity: 0.42; }

.source-band {
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  color: #fff;
  background: var(--ink);
  border-radius: 6px;
}
.source-band > div { padding: 13px 16px; border-right: 1px solid #40474e; }
.source-band > div:last-child { border-right: 0; }
.source-band strong,
.source-band span { display: block; }
.source-band span { margin-top: 4px; color: #cbd1d5; font-size: 0.72rem; }

.green-kpi { border-top-color: var(--green-key); }
.green-kpi.amber { border-top-color: var(--amber); }
.green-kpi.red { border-top-color: var(--red); }

.decision-panel {
  margin-bottom: 18px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.decision-list { display: grid; gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 5px; background: var(--line); }
.decision-row {
  min-height: 66px;
  padding: 11px 13px;
  display: grid;
  grid-template-columns: 7px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  background: #fff;
}
.decision-row::before { content: ""; width: 7px; height: 34px; border-radius: 2px; background: var(--amber); }
.decision-row.good::before { background: var(--green-key); }
.decision-row.critical::before { background: var(--red); }
.decision-row strong,
.decision-row span { display: block; }
.decision-row span { margin-top: 3px; color: var(--muted); font-size: 0.76rem; }
.decision-value { text-align: right; white-space: nowrap; }
.decision-value strong { font-size: 1.05rem; }

.monthly-chart {
  height: 270px;
  padding: 18px 8px 0;
  display: flex;
  align-items: stretch;
  gap: 8px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}
.month-group {
  min-width: 58px;
  flex: 1 0 58px;
  padding: 0 3px;
  display: grid;
  grid-template-rows: 1fr 32px;
  gap: 7px;
  color: inherit;
  background: transparent;
  border: 0;
}
.month-group:hover,
.month-group:focus-visible { background: #f3f6f4; }
.month-bars { display: flex; align-items: end; justify-content: center; gap: 3px; }
.month-bar { width: min(24px, 48%); height: var(--scale, 0%); background: var(--green-key); border-radius: 3px 3px 0 0; }
.month-bar.reference { background: var(--ink); }
.month-label { color: var(--muted); font-size: 0.68rem; text-align: center; text-transform: capitalize; }

.family-rank { display: grid; gap: 12px; }
.family-rank-row { display: grid; gap: 5px; }
.family-rank-head { display: flex; justify-content: space-between; gap: 10px; font-size: 0.78rem; }
.family-rank-head span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.family-track { height: 8px; overflow: hidden; border-radius: 3px; background: #e8ecee; }
.family-track i { display: block; width: var(--scale, 0%); height: 100%; border-radius: inherit; background: var(--green-key); }

.scale-0 { --scale: 0%; }
.scale-5 { --scale: 5%; }
.scale-10 { --scale: 10%; }
.scale-15 { --scale: 15%; }
.scale-20 { --scale: 20%; }
.scale-25 { --scale: 25%; }
.scale-30 { --scale: 30%; }
.scale-35 { --scale: 35%; }
.scale-40 { --scale: 40%; }
.scale-45 { --scale: 45%; }
.scale-50 { --scale: 50%; }
.scale-55 { --scale: 55%; }
.scale-60 { --scale: 60%; }
.scale-65 { --scale: 65%; }
.scale-70 { --scale: 70%; }
.scale-75 { --scale: 75%; }
.scale-80 { --scale: 80%; }
.scale-85 { --scale: 85%; }
.scale-90 { --scale: 90%; }
.scale-95 { --scale: 95%; }
.scale-100 { --scale: 100%; }

.chart-tooltip { inset: auto 16px 16px auto; }

.scope-note {
  margin-bottom: 18px;
  padding: 13px 15px;
  color: #3f4d58;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green-key);
  border-radius: 5px;
}
.scope-note.warning { border-left-color: var(--amber); background: var(--amber-soft); }
.scope-note strong,
.scope-note span { display: block; }
.scope-note span { margin-top: 4px; color: var(--muted); font-size: 0.78rem; }

.product-name { min-width: 280px; }
.product-name strong,
.product-name span { display: block; }
.product-name span { margin-top: 3px; color: var(--muted); }
.status-ok { color: #075c57; background: var(--green-key-soft); }
.status-warning { color: #754700; background: var(--amber-soft); }

@media (max-width: 1180px) {
  .green-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .source-band { grid-template-columns: 1fr; }
  .source-band > div { border-right: 0; border-bottom: 1px solid #40474e; }
  .source-band > div:last-child { border-bottom: 0; }
}

@media (max-width: 760px) {
  .green-filter-head { align-items: stretch; flex-direction: column; }
  .green-filter-head .quiet { align-self: flex-start; }
  .green-filters { grid-template-columns: 1fr 1fr; }
  .green-filters label:first-child,
  .metric-control { grid-column: 1 / -1; }
  .decision-row { grid-template-columns: 7px minmax(0, 1fr); }
  .decision-value { grid-column: 2; text-align: left; }
}

@media (max-width: 470px) {
  .green-filters { grid-template-columns: 1fr; }
  .green-filters label:first-child,
  .metric-control { grid-column: auto; }
  .family-buttons { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .family-buttons button { flex: 0 0 auto; }
}
