/* App Health / Diagnostics page (Phase 9b). Reuses the admin design tokens. */

.diag-bars { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.diag-bar-row { display: grid; grid-template-columns: minmax(90px, 40%) 1fr auto; align-items: center; gap: 10px; }
.diag-bar-label {
  font-size: 13px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.diag-bar-track { height: 8px; border-radius: 6px; background: var(--surface-soft); overflow: hidden; }
.diag-bar-fill { display: block; height: 100%; border-radius: 6px; background: var(--accent); }
.diag-bar-value { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.diag-chip {
  display: inline-block; padding: 2px 8px; margin: 1px 0; border-radius: 999px;
  background: var(--surface-soft); border: 1px solid var(--border);
  font-size: 12px; color: var(--text);
}

.diag-sev, .diag-status {
  display: inline-block; padding: 2px 8px; border-radius: 6px;
  font-size: 12px; font-weight: 600; text-transform: capitalize;
}
.diag-sev.is-danger { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.diag-sev.is-error  { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.diag-sev.is-warning{ background: color-mix(in srgb, var(--gold) 20%, transparent); color: var(--gold); }
.diag-sev.is-muted  { background: var(--surface-soft); color: var(--muted); }

.diag-status.is-open    { background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--gold); }
.diag-status.is-success { background: color-mix(in srgb, var(--success) 16%, transparent); color: var(--success); }
.diag-status.is-muted   { background: var(--surface-soft); color: var(--muted); }

.diag-issue-row { cursor: pointer; }
.diag-issue-title { font-weight: 600; color: var(--text); }

/* Detail drawer */
.diag-overlay {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(0, 0, 0, 0.45);
  display: flex; justify-content: flex-end;
}
.diag-overlay[hidden] { display: none; }
.diag-drawer {
  width: min(720px, 100%); height: 100%; overflow-y: auto;
  background: var(--surface); border-left: 1px solid var(--border);
  padding: 20px; box-shadow: var(--shadow);
}
.diag-events { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.diag-event { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-soft); }
.diag-event > summary {
  cursor: pointer; padding: 8px 10px; display: grid;
  grid-template-columns: auto auto 1fr; gap: 10px; align-items: center;
}
.diag-event-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.diag-event-plat { font-size: 12px; color: var(--accent); }
.diag-event-msg { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.diag-event-body { padding: 0 10px 10px; }
.diag-stack {
  white-space: pre-wrap; word-break: break-word; font-size: 12px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px; max-height: 320px; overflow: auto; color: var(--text);
}

@media (max-width: 640px) {
  .diag-bar-row { grid-template-columns: minmax(70px, 45%) 1fr auto; }
  .diag-event > summary { grid-template-columns: 1fr; gap: 2px; }
}
