@layer components {

/* MODEC-style metric card (overrides legacy .kpi-card.report-metrics-card layout
   for the 6 Overview cards inside #bugsAllProjectsLayout). The outer .ds-card
   already provides white bg, border, radius, and subtle shadow. */
/* ── Aegis-style Metric Card (.ds-metric-card) ──
 * Reusable summary-with-breakdown card: title + Total chip + arrow
 * header, divider, body with optional left-side chart + right-side
 * dot-list legend. Use anywhere a "metric with per-category breakdown"
 * is needed (Test Insights, QC monitoring per-QC cards, etc.). */
.ds-metric-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.ds-metric-card__header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
}
.ds-metric-card__title {
  margin: 0;
  flex: 1;
  min-width: 0;
  /* MODEC: smaller + lighter so card title fits on one row */
  font-size: var(--font-size-base);          /* 16px */
  font-weight: var(--font-weight-medium);    /* 500 */
  color: var(--color-text-primary);
  line-height: 1.3;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ds-metric-card__total {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
  background: var(--c-neutral-100);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  flex-shrink: 0;
}
.ds-metric-card__arrow {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.12s ease, color 0.12s ease;
  padding: 0;
  flex-shrink: 0;
}
.ds-metric-card__arrow:hover {
  background: var(--color-bg-surface-alt);
  color: var(--color-accent);
}
.ds-metric-card__body {
  border-top: var(--border-width-1) solid var(--color-divider);
  padding: var(--space-3) var(--space-4);
  flex: 1;
  /* Two-column grid: chart left (auto width), list right (fills). */
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-4);
  align-items: center;
}
/* When no chart is present, list takes the full body width. */
.ds-metric-card__body:not(:has(.ds-metric-card__chart)) {
  grid-template-columns: 1fr;
}
.ds-metric-card__chart {
  width: 140px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ds-metric-card__chart .distribution-pie { width: 120px; height: 120px; }

/* Stacked bar legend (for cards with multi-segment bars, e.g. Bug + _bug) */
.ds-metric-card__legend {
  display: flex;
  gap: var(--space-3);
  padding: 0 var(--space-4) var(--space-2);
  font-size: 11px;
  color: var(--color-text-secondary);
}
.ds-metric-card__legend-item { display: inline-flex; align-items: center; gap: 6px; }
.ds-metric-card__legend-dot { width: 8px; height: 8px; border-radius: var(--radius-full); display: inline-block; }

.ds-metric-card__list { list-style: none; margin: 0; padding: 0; min-width: 0; }
/* Default row layout (for pie-companion lists): dot | label | value */
.ds-metric-card__row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-2);
  padding: 4px 0;
  font-size: 11px;
  line-height: 1.4;
}
/* Bar row layout (for cards with no chart, inline horizontal bar instead) */
.ds-metric-card__row--with-bar {
  grid-template-columns: minmax(0, 1fr) minmax(60px, 2fr) auto;
}
.ds-metric-card__dot {
  width: 8px; height: 8px;
  border-radius: var(--radius-full);
  display: inline-block;
  flex-shrink: 0;
}
.ds-metric-card__label {
  color: var(--color-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ds-metric-card__value {
  color: var(--color-text-primary);
  font-variant-numeric: tabular-nums;
  font-weight: var(--font-weight-medium);
  text-align: right;
  white-space: nowrap;
}
/* Inline bar (track + fill) shown in the middle column of each row */
.ds-metric-card__bar {
  position: relative;
  height: 8px;
  background: var(--c-neutral-200);
  border-radius: var(--radius-full);
  overflow: hidden;
  min-width: 40px;
}
.ds-metric-card__bar-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--color-accent);
  border-radius: var(--radius-full);
}
.ds-metric-card__bar-fill--success { background: var(--c-success-500); }
.ds-metric-card__bar-fill--warning { background: var(--c-warning-500); }
.ds-metric-card__bar-fill--danger  { background: var(--c-danger-500); }
.ds-metric-card__bar-fill--neutral { background: var(--c-neutral-400); }
/* Stacked variant — multiple segments side-by-side */
.ds-metric-card__bar--stacked { display: flex; align-items: stretch; background: var(--c-neutral-200); }
.ds-metric-card__bar--stacked .ds-metric-card__bar-fill {
  position: static; height: 100%; border-radius: 0;
}
.ds-metric-card__bar--stacked .ds-metric-card__bar-fill:first-child { border-top-left-radius: var(--radius-full); border-bottom-left-radius: var(--radius-full); }
.ds-metric-card__bar--stacked .ds-metric-card__bar-fill:last-child  { border-top-right-radius: var(--radius-full); border-bottom-right-radius: var(--radius-full); }

} /* end @layer components */
