/* ---------------------------------------------------------------------------
 * OpenVision GRC — additions for the data-driven portal.
 *
 * shell.css is the original hand-written design system and is untouched. This
 * file only adds what a live-API portal needs that a static mockup never had:
 * loading states, inline error panels, gauges and distribution bars.
 * ------------------------------------------------------------------------- */

/* ------------------------------------------------------------ load states */

/* Every panel starts in this state and is replaced wholesale when its request
   settles, so a page never shows a stale mix of old and new numbers. */
[data-mount] {
  min-height: 80px;
}

.load {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  padding: 26px 4px;
  font-size: 13.5px;
}

.load::before {
  content: "";
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--blue);
  animation: pv-spin .7s linear infinite;
}

@keyframes pv-spin { to { transform: rotate(360deg); } }

.loaderr {
  border: 1px solid #f3c4cc;
  background: #fdecef;
  color: #a1253a;
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 13.5px;
}

.loaderr b { display: block; margin-bottom: 4px; }
.loaderr code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: #7d1c2c;
}

/* ------------------------------------------------------------------ gauges */

/* Horizontal magnitude bar. `i` is scaled by the inline width the renderer
   sets, and clamped in CSS so a rogue value cannot overflow the card. */
.gauge {
  height: 8px;
  border-radius: 999px;
  background: var(--soft);
  overflow: hidden;
  margin-top: 8px;
}

.gauge > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--blue);
  max-width: 100%;
  transition: width .4s ease;
}

.gauge.good > i { background: var(--green); }
.gauge.warn > i { background: var(--orange); }
.gauge.bad > i { background: var(--red); }

.gauge-row {
  display: grid;
  grid-template-columns: 130px 1fr 74px;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  font-size: 13px;
}
.gauge-row .k { color: var(--muted); }
.gauge-row .v { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Score dial for the assurance headline. */
.score {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.score .n {
  font-size: 54px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.score .g { font-size: 14px; font-weight: 800; letter-spacing: 1px; }

/* ------------------------------------------------------------- heatmap 5x5 */

.heat {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  margin-top: 10px;
}
.heat div {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-weight: 800;
  font-size: 15px;
  color: #fff;
  background: var(--soft);
}
.heat-axis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  margin-top: 6px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: var(--muted);
  text-align: center;
}

/* --------------------------------------------------------------- sparklines */

/* One stacked proportional bar, used for priority / severity distributions. */
.split { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--soft); margin-top: 10px; }
.split > i { display: block; height: 100%; }
.split-key { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 9px; font-size: 12.5px; }
.split-key span { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.split-key i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

/* shell.css has no .empty — a table with no rows still needs to say so. */
.empty {
  padding: 26px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* ------------------------------------------------------------------- table */

.dt th { text-transform: uppercase; letter-spacing: .4px; font-size: 11px; color: var(--muted); }
.dt td.num { text-align: right; font-variant-numeric: tabular-nums; }
.dt .code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; color: var(--muted); }
.dt tbody tr td { padding: 10px 12px; }
.trunc { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Sticky-ish section header row with an action on the right. */
.rowhead {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 14px;
}
.rowhead h3 { margin: 0; font-size: 15px; }
.rowhead .grow { flex: 1; }

/* Live-data provenance line, so a figure on screen can be traced to its source. */
.srcline {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 18px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

a.rowlink { color: inherit; text-decoration: none; }
a.rowlink:hover { text-decoration: underline; }