/* ── Compliance summary widgets ──────────────────────────────────────── */

#compliance-summary {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.comp-widget {
  flex: 1;
  min-width: 260px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.comp-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.comp-widget-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.range-btns { display: flex; gap: 2px; }

.range-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 0.7rem;
  padding: 1px 5px;
  border-radius: 3px;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.range-btn:hover { color: var(--text); border-color: var(--border); }
.range-btn.active { color: var(--accent); border-color: var(--accent); background: var(--accent-a10); }

.comp-widget-legend { display: flex; gap: 0.85rem; }

.cw-leg {
  font-size: 0.76rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.cw-leg::before {
  content: "";
  width: 12px;
  height: 2px;
  border-radius: 1px;
  display: inline-block;
}
.cw-leg.pass::before  { background: var(--ok-2); }
.cw-leg.fail::before  { background: var(--danger-3); }
.cw-leg.unval::before { background: var(--warn-3); }

.comp-chart-area { overflow: hidden; }

.sev-rows {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.sev-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.sev-label {
  width: 54px;
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 500;
}

.sev-spark {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  border-radius: 3px;
}

.sev-count {
  width: 28px;
  flex-shrink: 0;
  text-align: right;
  font-size: 0.82rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ── Chart theming ───────────────────────────────────────────────────
   The charts are hand-drawn SVG. Their colors used to be baked into the
   JS as hex — which meant (a) the severity sparkline had its own palette
   that no chip agreed with, and (b) nothing re-themed on a light/dark
   toggle, and the posture chart's axis text (#9aa3b2) and gridlines
   (#2a2f3a — the PRE-REBRAND border) were unreadable / near-black on a
   white card.

   SVG presentation attributes sit below author CSS in the cascade, so
   styling them from here themes every chart with no re-render, and the
   severity ramp is the same one the chips use. Keep it that way: do not
   reintroduce a hex into compliance-summary.js or donut.js. */

/* severity ink — sparkline row label, count, tooltip, VA stat cards */
.sev-ink-critical { color: var(--sev-critical); }
.sev-ink-high     { color: var(--sev-high); }
.sev-ink-medium   { color: var(--sev-medium); }
.sev-ink-low      { color: var(--sev-low); }
.sev-count-zero   { color: var(--dim); }

/* severity sparklines */
.sev-line-critical { stroke: var(--sev-critical-line); }
.sev-line-high     { stroke: var(--sev-high-line); }
.sev-line-medium   { stroke: var(--sev-medium-line); }
.sev-line-low      { stroke: var(--sev-low-line); }

.sev-area-critical { fill: var(--sev-critical-bg); }
.sev-area-high     { fill: var(--sev-high-bg); }
.sev-area-medium   { fill: var(--sev-medium-bg); }
.sev-area-low      { fill: var(--sev-low-bg); }

.sev-dot-critical  { fill: var(--sev-critical-line); }
.sev-dot-high      { fill: var(--sev-high-line); }
.sev-dot-medium    { fill: var(--sev-medium-line); }
.sev-dot-low       { fill: var(--sev-low-line); }

/* posture chart — pass/fail is a STATUS pair, not a severity, so it stays
   on --ok / --danger rather than the --sev-* ramp. */
.chart-axis        { fill: var(--dim); }
.chart-grid        { stroke: var(--border); }
.chart-pass-line   { stroke: var(--ok-2); }
.chart-pass-area   { fill: var(--ok-bg); }
.chart-pass-dot    { fill: var(--ok-2); }
.chart-fail-line   { stroke: var(--danger-3); }
.chart-fail-area   { fill: var(--danger-bg); }
.chart-fail-dot    { fill: var(--danger-3); }
/* "Awaiting evidence" is a third posture state, not a shade of fail — it sits
   in the denominator (posture.js) so it must be drawable, and on --warn so it
   reads as unresolved rather than broken. */
.chart-unval-line  { stroke: var(--warn-3); }
.chart-unval-area  { fill: var(--warn-bg); }
.chart-unval-dot   { fill: var(--warn-3); }
.tt-dot-pass       { color: var(--ok-2); }
.tt-dot-fail       { color: var(--danger-3); }
.tt-dot-unval      { color: var(--warn-3); }

/* H.1.7 cutover-marker annotation (was a hardcoded #7c5cff purple) */
.chart-marker-line { stroke: var(--info); }
.chart-marker-tag  { fill: var(--info); }

/* donut */
.chart-donut-empty { stroke: var(--border); }
.chart-donut-seg   { stroke: var(--panel); }  /* the hairline between slices
                                                 must match the card it sits
                                                 on — it was the old page bg */
.chart-donut-total { fill: var(--text); }

/* ── Categorical donut swatches ───────────────────────────────────────
   Identity hues for the inventory donuts. Same pattern as .sev-line-*:
   the JS emits a SLUG, never a colour, and the pairing lives here.
   donut.js sets no `fill` presentation attribute and the legend dot has
   NO inline style — an inline style outranks a class, so the dot would
   have pinned itself to whatever hex the JS knew about and stopped
   theming. Adding a category = a --cat-* token + the two rules below;
   do not reintroduce a hex into inventory.js or donut.js. */
.donut-seg-relational { fill: var(--cat-relational); }
.donut-seg-nosql      { fill: var(--cat-nosql); }
.donut-seg-cache      { fill: var(--cat-cache); }
.donut-seg-warehouse  { fill: var(--cat-warehouse); }
.donut-seg-document   { fill: var(--cat-document); }
.donut-seg-graph      { fill: var(--cat-graph); }
.donut-seg-timeseries { fill: var(--cat-timeseries); }
.donut-seg-ledger     { fill: var(--cat-ledger); }
.donut-seg-widecolumn { fill: var(--cat-widecolumn); }
.donut-seg-search     { fill: var(--cat-search); }
.donut-seg-tables     { fill: var(--cat-tables); }
.donut-seg-other      { fill: var(--cat-other); }

.donut-dot-relational { background: var(--cat-relational); }
.donut-dot-nosql      { background: var(--cat-nosql); }
.donut-dot-cache      { background: var(--cat-cache); }
.donut-dot-warehouse  { background: var(--cat-warehouse); }
.donut-dot-document   { background: var(--cat-document); }
.donut-dot-graph      { background: var(--cat-graph); }
.donut-dot-timeseries { background: var(--cat-timeseries); }
.donut-dot-ledger     { background: var(--cat-ledger); }
.donut-dot-widecolumn { background: var(--cat-widecolumn); }
.donut-dot-search     { background: var(--cat-search); }
.donut-dot-tables     { background: var(--cat-tables); }
.donut-dot-other      { background: var(--cat-other); }

/* ── Inventory donut charts ──────────────────────────────────────────── */

#inv-charts {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.inv-chart-widget {
  flex: 1;
  min-width: 280px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.inv-chart-body {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.inv-donut-area { flex-shrink: 0; }

.inv-donut-legend {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.inv-leg-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
}

.inv-leg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.inv-leg-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inv-leg-val {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.inv-leg-pct {
  font-variant-numeric: tabular-nums;
  min-width: 32px;
  text-align: right;
}

/* ── Chart tooltip ───────────────────────────────────────────────────── */

.chart-tooltip {
  position: fixed;
  z-index: 9999;
  background: var(--panel-2);
  border: 1px solid var(--panel-3);
  border-radius: 6px;
  padding: 0.45rem 0.65rem;
  pointer-events: none;
  font-size: 0.78rem;
  line-height: 1.5;
  box-shadow: 0 4px 16px var(--shadow);
  min-width: 120px;
}

.chart-tooltip .tt-date {
  color: var(--muted);
  font-size: 0.72rem;
  margin-bottom: 2px;
}

.chart-tooltip .tt-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  color: var(--text);
}
